本文整理汇总了Java中net.bither.bitherj.utils.BlockUtil类的典型用法代码示例。如果您正苦于以下问题:Java BlockUtil类的具体用法?Java BlockUtil怎么用?Java BlockUtil使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
BlockUtil类属于net.bither.bitherj.utils包,在下文中一共展示了BlockUtil类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: run
import net.bither.bitherj.utils.BlockUtil; //导入依赖的package包/类
@Override
public void run() {
prepare();
try {
Block block = BlockUtil.dowloadSpvBlock();
if (block != null) {
success(null);
} else {
error(0, null);
}
} catch (Exception e) {
error(0, null);
e.printStackTrace();
}
}
示例2: startPeerInBackground
import net.bither.bitherj.utils.BlockUtil; //导入依赖的package包/类
private static synchronized void startPeerInBackground() {
try {
if (!peerCanRun) {
return;
}
if (!UserPreference.getInstance().getDownloadSpvFinish()) {
BlockUtil.dowloadSpvBlock();
}
if (UserPreference.getInstance().getAppMode() != BitherjSettings.AppMode.COLD) {
if (!UserPreference.getInstance().getBitherjDoneSyncFromSpv()) {
if (!PeerManager.instance().isConnected()) {
PeerManager.instance().start();
}
} else {
if (!AddressManager.getInstance().addressIsSyncComplete()) {
TransactionsUtil.getMyTxFromBither();
}
startPeerManager();
}
}
} catch (Exception e) {
e.printStackTrace();
}
}
示例3: run
import net.bither.bitherj.utils.BlockUtil; //导入依赖的package包/类
@Override
public void run() {
obtainMessage(HandlerMessage.MSG_PREPARE);
try {
Block block = BlockUtil.dowloadSpvBlock();
if (block != null) {
obtainMessage(HandlerMessage.MSG_SUCCESS);
} else {
obtainMessage(HandlerMessage.MSG_FAILURE);
}
} catch (Exception e) {
obtainMessage(HandlerMessage.MSG_FAILURE);
e.printStackTrace();
}
}
示例4: startPeer
import net.bither.bitherj.utils.BlockUtil; //导入依赖的package包/类
private synchronized void startPeer() {
try {
if (peerCanNotRun) {
return;
}
if (UpgradeUtil.needUpgrade()) {
return;
}
if (!AppSharedPreference.getInstance().getDownloadSpvFinish()) {
Block block = BlockUtil.dowloadSpvBlock();
if (block == null) {
return;
}
}
if (AppSharedPreference.getInstance().getAppMode() != BitherjSettings.AppMode.COLD) {
if (!AppSharedPreference.getInstance().getBitherjDoneSyncFromSpv()) {
if (!PeerManager.instance().isConnected()) {
PeerManager.instance().start();
if (!spvFinishedReceivered) {
final IntentFilter intentFilter = new IntentFilter();
intentFilter.addAction(NotificationAndroidImpl.ACTION_SYNC_FROM_SPV_FINISHED);
spvFinishedReceiver = new SPVFinishedReceiver();
registerReceiver(spvFinishedReceiver, intentFilter);
spvFinishedReceivered = true;
}
}
} else {
if (!AddressManager.getInstance().addressIsSyncComplete()) {
TransactionsUtil.getMyTxFromBither();
}
startPeerManager();
}
}
} catch (Exception e) {
e.printStackTrace();
}
}
示例5: setResult
import net.bither.bitherj.utils.BlockUtil; //导入依赖的package包/类
@Override
public void setResult(String response) throws Exception {
JSONObject jsonObject = new JSONObject(response);
JSONArray jsonArray = jsonObject.getJSONArray("blocks");
JSONObject jsonObject1 = (JSONObject) jsonArray.get(0);
this.result = BlockUtil.formatStoreBlockFromBlockChainInfo(jsonObject1);
}
示例6: setResult
import net.bither.bitherj.utils.BlockUtil; //导入依赖的package包/类
@Override
public void setResult(String response) throws Exception {
JSONObject jsonObject = new JSONObject(response);
this.result = BlockUtil.getLatestBlockHeight(jsonObject);
}
示例7: setResult
import net.bither.bitherj.utils.BlockUtil; //导入依赖的package包/类
@Override
public void setResult(String response) throws Exception {
JSONObject jsonObject = new JSONObject(response);
this.result = BlockUtil.formatStoredBlock(jsonObject);
}