def add_hash160data(self, rawtx, hexdata, dust_limit=common.DUST_LIMIT): """Writes <hexdata> as new Pay-to-PubkeyHash output to <rawtx>.""" tx = deserialize.unsignedtx(rawtx) dust_limit = deserialize.positive_integer(dust_limit) hash160data_txout = deserialize.hash160data_txout(hexdata, dust_limit) tx = control.add_hash160data_output(tx, hash160data_txout) return serialize.tx(tx)
def test_data_size(self): # twenty bytes ok max_data = 20 * b"aa" deserialize.hash160data_txout(max_data) # > twenty bytes fails def callback(): over_max_data = 21 * b"aa" deserialize.hash160data_txout(over_max_data) self.assertRaises(exceptions.InvalidHash160DataSize, callback) # < twenty bytes fails def callback(): over_max_data = 19 * b"aa" deserialize.hash160data_txout(over_max_data) self.assertRaises(exceptions.InvalidHash160DataSize, callback)
def callback(): over_max_data = 19 * b"aa" deserialize.hash160data_txout(over_max_data)