tweak hoek interface
This commit is contained in:
@@ -25,7 +25,7 @@ def test_fulfillment_wrong_signature(inp):
|
||||
signed = sign(spend)
|
||||
|
||||
# Set the correct pubkey, signature is bob's
|
||||
signed['tx']['inputs'][0]['script']['fulfillment']['publicKey'] = alice_pk
|
||||
signed['inputs'][0]['script']['fulfillment']['publicKey'] = alice_pk
|
||||
|
||||
try:
|
||||
assert not submit(signed), 'should raise an error'
|
||||
@@ -39,7 +39,7 @@ def test_fulfillment_wrong_pubkey(inp):
|
||||
signed = sign(spend)
|
||||
|
||||
# Set the wrong pubkey, signature is correct
|
||||
signed['tx']['inputs'][0]['script']['fulfillment']['publicKey'] = bob_pk
|
||||
signed['inputs'][0]['script']['fulfillment']['publicKey'] = bob_pk
|
||||
|
||||
try:
|
||||
assert not submit(signed), 'should raise an error'
|
||||
@@ -54,7 +54,7 @@ def test_invalid_fulfillment_binary(inp):
|
||||
spend = {'inputs': [inp], 'outputs': [nospend]}
|
||||
|
||||
try:
|
||||
assert not submit({'tx': spend}), 'should raise an error'
|
||||
assert not submit(spend), 'should raise an error'
|
||||
except RPCError as e:
|
||||
assert 'Crypto-Condition payload is invalid' in str(e), str(e)
|
||||
|
||||
@@ -85,7 +85,7 @@ def test_oversize_fulfillment(inp):
|
||||
spend = {'inputs': [inp], 'outputs': [nospend]}
|
||||
|
||||
try:
|
||||
assert not submit({'tx': spend}), 'should raise an error'
|
||||
assert not submit(spend), 'should raise an error'
|
||||
except RPCError as e:
|
||||
assert 'scriptsig-size' in str(e), str(e)
|
||||
|
||||
@@ -206,7 +206,7 @@ def test_secp256k1_condition(inp):
|
||||
'outputs': [{'amount': 500, 'script': {'condition': ec_cond}}]
|
||||
}
|
||||
signed = sign(spend2)
|
||||
signed['tx']['inputs'][0]['script']['fulfillment']['publicKey'] = \
|
||||
signed['inputs'][0]['script']['fulfillment']['publicKey'] = \
|
||||
'0275cef12fc5c49be64f5aab3d1fbba08cd7b0d02908b5112fbd8504218d14bc7d'
|
||||
try:
|
||||
assert not submit(signed), 'should raise an error'
|
||||
|
||||
@@ -74,8 +74,8 @@ def wait_for_block(height):
|
||||
|
||||
def sign(tx):
|
||||
signed = hoek.signTxBitcoin({'tx': tx, 'privateKeys': [notary_sk]})
|
||||
signed = hoek.signTxEd25519({'tx': signed['tx'], 'privateKeys': [alice_sk, bob_sk]})
|
||||
return hoek.signTxSecp256k1({'tx': signed['tx'], 'privateKeys': [notary_sk]})
|
||||
signed = hoek.signTxEd25519({'tx': signed, 'privateKeys': [alice_sk, bob_sk]})
|
||||
return hoek.signTxSecp256k1({'tx': signed, 'privateKeys': [notary_sk]})
|
||||
|
||||
|
||||
def submit(tx):
|
||||
@@ -95,7 +95,7 @@ def get_fanout_txid():
|
||||
reward_txid = block['tx'][0]
|
||||
reward_tx_raw = rpc.getrawtransaction(reward_txid)
|
||||
reward_tx = hoek.decodeTx({'hex': reward_tx_raw})
|
||||
balance = reward_tx['tx']['outputs'][0]['amount']
|
||||
balance = reward_tx['outputs'][0]['amount']
|
||||
|
||||
n_outs = 16
|
||||
remainder = balance - n_outs * 1000
|
||||
|
||||
Reference in New Issue
Block a user