Ejemplo n.º 1
0
 def test_restoring_wallet_with_manual_delete(self, mock_write):
     w = restore_wallet_from_text(
         "hint shock chair puzzle shock traffic drastic note dinosaur mention suggest sweet",
         path='if_this_exists_mocking_failed_648151893',
         gap_limit=5)['wallet']
     # txn A is an external incoming txn funding the wallet
     txA = Transaction(self.transactions[
         "0cce62d61ec87ad3e391e8cd752df62e0c952ce45f52885d6d10988e02794060"]
                       )
     w.add_transaction(txA.txid(), txA)
     # txn B is an outgoing payment to an external address
     txB = Transaction(self.transactions[
         "e7f4e47f41421e37a8600b6350befd586f30db60a88d0992d54df280498f0968"]
                       )
     w.add_transaction(txB.txid(), txB)
     # now the user manually deletes txn B to attempt the double spend
     # txn C is double-spending txn B, to a wallet address
     # rationale1: user might do this with opt-in RBF transactions
     # rationale2: this might be a local transaction, in which case the GUI even allows it
     w.remove_transaction(txB)
     txC = Transaction(self.transactions[
         "a04328fbc9f28268378a8b9cf103db21ca7d673bf1cc7fa4d61b6a7265f07a6b"]
                       )
     w.add_transaction(txC.txid(), txC)
     self.assertEqual(83500163, sum(w.get_balance()))
Ejemplo n.º 2
0
 def test_restoring_wallet_without_manual_delete(self, mock_write):
     w = restore_wallet_from_text(
         "hint shock chair puzzle shock traffic drastic note dinosaur mention suggest sweet",
         path='if_this_exists_mocking_failed_648151893',
         gap_limit=5)['wallet']
     for txid in self.transactions:
         tx = Transaction(self.transactions[txid])
         w.add_transaction(tx.txid(), tx)
     # txn A is an external incoming txn funding the wallet
     # txn B is an outgoing payment to an external address
     # txn C is double-spending txn B, to a wallet address
     self.assertEqual(83500163, sum(w.get_balance()))
Ejemplo n.º 3
0
 def test_verify_ok_t_tx(self):
     """Actually mined 64 byte tx should not raise."""
     t_tx = Transaction(VALID_64_BYTE_TX)
     t_tx_hash = t_tx.txid()
     self.assertEqual(MERKLE_ROOT, SPV.hash_merkle_root(MERKLE_BRANCH, t_tx_hash, 3))