use of co.rsk.peg.bitcoin.MerkleBranch in project rskj by rsksmart.
the class Bridge method getBtcTransactionConfirmations.
public int getBtcTransactionConfirmations(Object[] args) throws VMException {
logger.trace("getBtcTransactionConfirmations");
try {
Sha256Hash btcTxHash = Sha256Hash.wrap((byte[]) args[0]);
Sha256Hash btcBlockHash = Sha256Hash.wrap((byte[]) args[1]);
int merkleBranchPath = ((BigInteger) args[2]).intValue();
Object[] merkleBranchHashesArray = (Object[]) args[3];
List<Sha256Hash> merkleBranchHashes = Arrays.stream(merkleBranchHashesArray).map(hash -> Sha256Hash.wrap((byte[]) hash)).collect(Collectors.toList());
MerkleBranch merkleBranch = new MerkleBranch(merkleBranchHashes, merkleBranchPath);
return bridgeSupport.getBtcTransactionConfirmations(btcTxHash, btcBlockHash, merkleBranch);
} catch (Exception e) {
logger.warn("Exception in getBtcTransactionConfirmations", e);
throw new VMException("Exception in getBtcTransactionConfirmations", e);
}
}
Aggregations