use of co.rsk.mine.SubmitBlockResult in project rskj by rsksmart.
the class MnrModuleImpl method submitBitcoinBlockTransactions.
@Override
public SubmittedBlockInfo submitBitcoinBlockTransactions(String blockHashHex, String blockHeaderHex, String coinbaseHex, String txnHashesHex) {
logger.debug("submitBitcoinBlockTransactions(): {}, {}, {}, {}", blockHashHex, blockHeaderHex, coinbaseHex, txnHashesHex);
NetworkParameters params = RegTestParams.get();
new Context(params);
BtcBlock bitcoinBlockWithHeaderOnly = getBtcBlock(blockHeaderHex, params);
BtcTransaction coinbase = new BtcTransaction(params, Hex.decode(coinbaseHex));
String blockHashForMergedMining = extractBlockHashForMergedMining(coinbase);
List<String> txnHashes = parseHashes(txnHashesHex);
SubmitBlockResult result = minerServer.submitBitcoinBlockTransactions(blockHashForMergedMining, bitcoinBlockWithHeaderOnly, coinbase, txnHashes);
return parseResultAndReturn(result);
}
use of co.rsk.mine.SubmitBlockResult in project rskj by rsksmart.
the class MnrModuleImpl method submitBitcoinBlockPartialMerkle.
@Override
public SubmittedBlockInfo submitBitcoinBlockPartialMerkle(String blockHashHex, String blockHeaderHex, String coinbaseHex, String merkleHashesHex, String blockTxnCountHex) {
logger.debug("submitBitcoinBlockPartialMerkle(): {}, {}, {}, {}, {}", blockHashHex, blockHeaderHex, coinbaseHex, merkleHashesHex, blockTxnCountHex);
if (merkleHashesHex.isEmpty()) {
throw new JsonRpcSubmitBlockException("The list of merkle hashes can't be empty");
}
NetworkParameters params = RegTestParams.get();
new Context(params);
BtcBlock bitcoinBlockWithHeaderOnly = getBtcBlock(blockHeaderHex, params);
BtcTransaction coinbase = new BtcTransaction(params, Hex.decode(coinbaseHex));
String blockHashForMergedMining = extractBlockHashForMergedMining(coinbase);
List<String> merkleHashes = parseHashes(merkleHashesHex);
int txnCount = Integer.parseInt(blockTxnCountHex, 16);
SubmitBlockResult result = minerServer.submitBitcoinBlockPartialMerkle(blockHashForMergedMining, bitcoinBlockWithHeaderOnly, coinbase, merkleHashes, txnCount);
return parseResultAndReturn(result);
}
use of co.rsk.mine.SubmitBlockResult in project rskj by rsksmart.
the class MnrModuleImpl method submitBitcoinBlock.
@Override
public SubmittedBlockInfo submitBitcoinBlock(String bitcoinBlockHex) {
logger.debug("submitBitcoinBlock(): {}", bitcoinBlockHex.length());
NetworkParameters params = RegTestParams.get();
new Context(params);
BtcBlock bitcoinBlock = getBtcBlock(bitcoinBlockHex, params);
BtcTransaction coinbase = bitcoinBlock.getTransactions().get(0);
String blockHashForMergedMining = extractBlockHashForMergedMining(coinbase);
SubmitBlockResult result = minerServer.submitBitcoinBlock(blockHashForMergedMining, bitcoinBlock);
return parseResultAndReturn(result);
}
Aggregations