Changeset View
Changeset View
Standalone View
Standalone View
test/functional/rpc_txoutproof.py
Show First 20 Lines • Show All 110 Lines • ▼ Show 20 Lines | def run_test(self): | ||||
# Make sure that our serialization/deserialization is working | # Make sure that our serialization/deserialization is working | ||||
assert txid1 in self.nodes[2].verifytxoutproof(ToHex(tweaked_proof)) | assert txid1 in self.nodes[2].verifytxoutproof(ToHex(tweaked_proof)) | ||||
# Check to see if we can go up the merkle tree and pass this off as a | # Check to see if we can go up the merkle tree and pass this off as a | ||||
# single-transaction block | # single-transaction block | ||||
tweaked_proof.txn.nTransactions = 1 | tweaked_proof.txn.nTransactions = 1 | ||||
tweaked_proof.txn.vHash = [tweaked_proof.header.hashMerkleRoot] | tweaked_proof.txn.vHash = [tweaked_proof.header.hashMerkleRoot] | ||||
tweaked_proof.txn.vBits = [True] + [False]*7 | tweaked_proof.txn.vBits = [True] + [False] * 7 | ||||
for n in self.nodes: | for n in self.nodes: | ||||
assert not n.verifytxoutproof(ToHex(tweaked_proof)) | assert not n.verifytxoutproof(ToHex(tweaked_proof)) | ||||
# TODO: try more variants, eg transactions at different depths, and | # TODO: try more variants, eg transactions at different depths, and | ||||
# verify that the proofs are invalid | # verify that the proofs are invalid | ||||
if __name__ == '__main__': | if __name__ == '__main__': | ||||
MerkleBlockTest().main() | MerkleBlockTest().main() |