Browse Source

Merge JoinMarket-Org/joinmarket-clientserver#1245: unused and missing vars in jmbitcoin tx code

8eefb4d68c unused and missing vars in jmbitcoin tx code (Adam Gibson)

Pull request description:

  Just noticed these while reading the code for some reason or other.

  The `btc.OP_RETURN` was presumably not fixed before because that code (burn addresses) is now entirely unused.

  However, this should be in the tests somewhere. We are missing tests for a lot of the functions in `secp256k1_transaction`. A PR should be opened by someone at some point to add those.

ACKs for top commit:
  kristapsk:
    ACK 8eefb4d68c

Tree-SHA512: 6cd7f959c1f798f14536a17c672a7ededbb4f962183aed17cba46a81955d91f5499bbd550a2de7bf337ed81660d55d00ea2f8b8cb0936c905f49a14ad405a6b9
master
Kristaps Kaupe 4 years ago
parent
commit
0d20aa977b
No known key found for this signature in database
GPG Key ID: 33E472FE870C7E5D
  1. 3
      jmbitcoin/jmbitcoin/secp256k1_transaction.py
  2. 1
      jmbitcoin/test/test_tx_signing.py

3
jmbitcoin/jmbitcoin/secp256k1_transaction.py

@ -214,7 +214,6 @@ def mk_freeze_script(pub, locktime):
raise TypeError("locktime must be int") raise TypeError("locktime must be int")
if not isinstance(pub, bytes): if not isinstance(pub, bytes):
raise TypeError("pubkey must be in bytes") raise TypeError("pubkey must be in bytes")
usehex = False
if not is_valid_pubkey(pub, require_compressed=True): if not is_valid_pubkey(pub, require_compressed=True):
raise ValueError("not a valid public key") raise ValueError("not a valid public key")
return CScript([locktime, OP_CHECKLOCKTIMEVERIFY, OP_DROP, pub, return CScript([locktime, OP_CHECKLOCKTIMEVERIFY, OP_DROP, pub,
@ -227,7 +226,7 @@ def mk_burn_script(data):
""" """
if not isinstance(data, bytes): if not isinstance(data, bytes):
raise TypeError("data must be in bytes") raise TypeError("data must be in bytes")
return CScript([btc.OP_RETURN, data]) return CScript([OP_RETURN, data])
def sign(tx, i, priv, hashcode=SIGHASH_ALL, amount=None, native=False): def sign(tx, i, priv, hashcode=SIGHASH_ALL, amount=None, native=False):
""" """

1
jmbitcoin/test/test_tx_signing.py

@ -35,7 +35,6 @@ def test_sign_standard_txs(addrtype):
amount_less_fee = int(amount - btc.coins_to_satoshi(0.01)) amount_less_fee = int(amount - btc.coins_to_satoshi(0.01))
# Create a destination to send the coins. # Create a destination to send the coins.
destination_address = address
target_scriptPubKey = scriptPubKey target_scriptPubKey = scriptPubKey
# Create the unsigned transaction. # Create the unsigned transaction.

Loading…
Cancel
Save