2012-12-03 15:36:03 +00:00
|
|
|
import unittest
|
2013-01-14 13:44:31 +00:00
|
|
|
import common
|
2012-12-03 15:36:03 +00:00
|
|
|
|
2013-01-14 18:22:02 +00:00
|
|
|
import bitkeylib.bitkey_pb2 as proto
|
|
|
|
|
2013-01-14 13:44:31 +00:00
|
|
|
class TestSignTx(common.BitkeyTest):
|
2012-12-03 15:36:03 +00:00
|
|
|
def test_signtx(self):
|
2013-01-14 18:22:02 +00:00
|
|
|
inp1 = proto.TxInput(index=0,
|
2013-01-24 20:20:41 +00:00
|
|
|
address_n=[1,0],
|
2013-01-14 18:22:02 +00:00
|
|
|
amount=100000000,
|
|
|
|
prev_hash='prevhash1234354346543456543654',
|
|
|
|
prev_index=11,
|
|
|
|
#script_sig=
|
|
|
|
)
|
|
|
|
|
|
|
|
inp2 = proto.TxInput(index=1,
|
2013-01-24 20:20:41 +00:00
|
|
|
address_n=[2,0],
|
2013-01-14 18:22:02 +00:00
|
|
|
amount=100000000,
|
|
|
|
prev_hash='prevhash2222254346543456543654',
|
|
|
|
prev_index=11,
|
|
|
|
#script_sig=
|
|
|
|
)
|
|
|
|
|
|
|
|
out1 = proto.TxOutput(index=0,
|
2013-01-24 20:20:41 +00:00
|
|
|
address='1BitkeyP2nDd5oa647AjvBbbwST54W5Zmx',
|
2013-01-14 18:22:02 +00:00
|
|
|
#address_n=[],
|
|
|
|
amount=100000000,
|
|
|
|
script_type=proto.PAYTOADDRESS,
|
|
|
|
#script_args=
|
|
|
|
)
|
|
|
|
|
|
|
|
out2 = proto.TxOutput(index=1,
|
2013-01-24 20:20:41 +00:00
|
|
|
address='1BitkeyP2nDd5oa647AjvBbbwST54W5Zmx',
|
2013-01-14 18:22:02 +00:00
|
|
|
#address_n=[],
|
|
|
|
amount=100000000,
|
|
|
|
script_type=proto.PAYTOADDRESS,
|
|
|
|
#script_args=
|
|
|
|
)
|
2013-01-24 20:20:41 +00:00
|
|
|
|
|
|
|
out3 = proto.TxOutput(index=2,
|
|
|
|
address='1MVgq4XaMX7PmohkYzFEisH1D7uxTiPbFK',
|
|
|
|
address_n=[2, 1],
|
|
|
|
amount=100000000,
|
|
|
|
script_type=proto.PAYTOADDRESS,
|
|
|
|
#script_args=
|
|
|
|
)
|
|
|
|
print self.bitkey.sign_tx([inp1, inp2], [out1, out2, out3])
|
2013-01-14 13:44:31 +00:00
|
|
|
|
|
|
|
if __name__ == '__main__':
|
|
|
|
unittest.main()
|