rpc: Return wtxid from testmempoolaccept

This commit is contained in:
MarcoFalke 2021-01-07 16:47:35 +01:00
parent 6af013792f
commit fa0aa87071
No known key found for this signature in database
GPG key ID: CE2B75697E69A548
7 changed files with 48 additions and 10 deletions

View file

@ -564,6 +564,9 @@ class CTransaction:
def serialize(self):
return self.serialize_with_witness()
def getwtxid(self):
return hash256(self.serialize())[::-1].hex()
# Recalculate the txid (transaction hash without witness)
def rehash(self):
self.sha256 = None
@ -579,7 +582,7 @@ class CTransaction:
if self.sha256 is None:
self.sha256 = uint256_from_str(hash256(self.serialize_without_witness()))
self.hash = encode(hash256(self.serialize_without_witness())[::-1], 'hex_codec').decode('ascii')
self.hash = hash256(self.serialize_without_witness())[::-1].hex()
def is_valid(self):
self.calc_sha256()

View file

@ -76,4 +76,4 @@ class MiniWallet:
from_node.sendrawtransaction(tx_hex)
assert_equal(tx_info['vsize'], vsize)
assert_equal(tx_info['fees']['base'], fee)
return {'txid': tx_info['txid'], 'wtxid': from_node.decoderawtransaction(tx_hex)['hash'], 'hex': tx_hex}
return {'txid': tx_info['txid'], 'wtxid': tx_info['wtxid'], 'hex': tx_hex}