shohu / c0ban

c0ban source tree
MIT License
0 stars 0 forks source link

Pass for test wallet-accounts.py #23

Closed shohu closed 6 years ago

shohu commented 6 years ago
# test/functional/wallet-accounts.py
2018-03-22 06:19:18.823000 TestFramework (INFO): Initializing test directory /tmp/testgwyasowg
> /c0ban/test/functional/wallet-accounts.py(40)run_test()
-> assert_equal(len(address_groups), 2)
2018-03-22 06:19:20.039000 TestFramework (ERROR): Assertion failed
Traceback (most recent call last):
  File "/c0ban/test/functional/test_framework/test_framework.py", line 120, in main
    self.run_test()
  File "test/functional/wallet-accounts.py", line 40, in run_test
    assert_equal(len(address_groups), 2)
  File "/c0ban/test/functional/test_framework/util.py", line 38, in assert_equal
    raise AssertionError("not(%s)" % " == ".join(str(arg) for arg in (thing1, thing2) + args))
AssertionError: not(2 == 1)
2018-03-22 06:19:20.047000 TestFramework (INFO): Stopping nodes
2018-03-22 06:19:22.287000 TestFramework (WARNING): Not cleaning up dir /tmp/testgwyasowg
2018-03-22 06:19:22.287000 TestFramework (ERROR): Test failed. Test logging available at /tmp/testgwyasowg/test_framework.log
shohu commented 6 years ago

listaddressgroupings Returns all addresses in the wallet and info used for coincontrol. https://en.bitcoin.it/wiki/Original_Bitcoin_client/API_calls_list

c0ban

> /c0ban/test/functional/wallet-accounts.py(65)run_test()
-> assert_equal(len(address_groups), 1)
(Pdb) p address_groups
[[['mmtfSMVKrJW4Hh1jaXJH6rtg1ENptkuf29', Decimal('0E-8')], ['mwnttGsugCAz61cxGtuaRN9ctkdW8XK4by', Decimal('21900.00000000')]], [['n3G75m93vYBoMQj4DyCatrRVSjkYmB8czp', Decimal('22000.00000000')]]]
(Pdb) l
2018-03-22 06:33:18.923847 Fee Calculation: Fee:3840 Bytes:192 Needed:3840 Tgt:0 (requested 6) Reason:"Fallback fee" Decay 0.00000: Estimation: (-1 - -1) -nan% 0.0/(0.0 0 mem 0.0 out) Fail: (-1 - -1) -nan% 0.0/(0.0 0 mem 0.0 out)
2018-03-22 06:33:18.923893 CommitTransaction:
CTransaction(hash=805595ee59, ver=2, vin.size=1, vout.size=2, nLockTime=102)
    CTxIn(COutPoint(10d4c589c3, 0), scriptSig=483045022100b349edb4fe84, nSequence=4294967294)
    CScriptWitness()
    CTxOut(nValue=99.99996160, scriptPubKey=76a914852a07c410d5b234a523a4fd)
    CTxOut(nValue=21900.00000000, scriptPubKey=76a914fc171479b5d1e8202808b650)
2018-03-22 06:33:18.923945 keypool keep 2
2018-03-22 06:33:18.925751 AddToWallet 805595ee59be6a018151a3f2f8d4d70bfcef608165a9ab0082212fb6bb62aeb7  new
2018-03-22 06:33:18.927682 nValueIn[2200000000000], tx.GetValueOut()[2199999996160] nValueIn[2200000000000], tx.GetValueOut()[2199999996160] AddToWallet 805595ee59be6a018151a3f2f8d4d70bfcef608165a9ab0082212fb6bb62aeb7
2018-03-22 06:33:18.927906 Relaying wtx 805595ee59be6a018151a3f2f8d4d70bfcef608165a9ab0082212fb6bb62aeb7
2018-03-22 06:33:21.310110 Flushing wallet.dat
2018-03-22 06:33:21.315184 Flushed wallet.dat 5ms
n
2018-03-22 06:33:35.853980 Received a POST request for / from 127.0.0.1:45584

bitcoin

(Pdb) n
> /bitcoin/test/functional/wallet-accounts.py(65)run_test()
-> assert_equal(len(address_groups), 1)
(Pdb) p address_groups
[[['msU5tfXYDrx3Rkb1u3ReaaDiMq2yJhGh5i', Decimal('0E-8')], ['n1v92BsD7XXtJNaFqvnUT5Y2XmiC49pZN3', Decimal('0E-8')]]]
2018-03-22 06:33:28.447804 Fee Calculation: Fee:5440 Bytes:272 Needed:5440 Tgt:0 (requested 6) Reason:"Fallback fee" Decay 0.00000: Estimation: (-1 - -1) -nan% 0.0/(0.0 0 mem 0.0 out) Fail: (-1 - -1) -nan% 0.0/(0.0 0 mem 0.0 out)
2018-03-22 06:33:28.447873 CommitTransaction:
CTransaction(hash=168cae9e00, ver=2, vin.size=2, vout.size=1, nLockTime=102)
    CTxIn(COutPoint(b9675610af, 0), scriptSig=47304402207318f6954bd2da, nSequence=4294967294)
    CTxIn(COutPoint(ac30bf1eb8, 0), scriptSig=4730440220260c9a51a214ee, nSequence=4294967294)
    CScriptWitness()
    CScriptWitness()
    CTxOut(nValue=99.99994560, scriptPubKey=76a914852a07c410d5b234a523a4fd)
2018-03-22 06:33:28.447964 AddToWallet 168cae9e00e6f6ce5942eb65150320a3c5f77f625f1d1cbc8af73f4f7113ef7f  new
2018-03-22 06:33:28.450754 AddToWallet 168cae9e00e6f6ce5942eb65150320a3c5f77f625f1d1cbc8af73f4f7113ef7f
2018-03-22 06:33:28.450807 Relaying wtx 168cae9e00e6f6ce5942eb65150320a3c5f77f625f1d1cbc8af73f4f7113ef7f
2018-03-22 06:33:29.076570 Received a POST request for / from 127.0.0.1:47438

fix

changed following part.

        txid = node.sendmany(
            fromaccount="",
            # amounts={common_address: 100},
            amounts={common_address: 44000},
            subtractfeefrom=[common_address],
            minconf=1,
        )

I realized following from c0ban vin = 1, bitcoin vin = 2

100 = 50 2 44000 = 22000 2

shohu commented 6 years ago

I got new Error

# test/functional/wallet-accounts.py
2018-03-22 06:42:28.913000 TestFramework (INFO): Initializing test directory /tmp/testpktnv1ov
2018-03-22 06:42:29.825000 TestFramework (ERROR): Assertion failed
Traceback (most recent call last):
  File "/c0ban/test/functional/test_framework/test_framework.py", line 120, in main
    self.run_test()
  File "test/functional/wallet-accounts.py", line 110, in run_test
    assert_equal(node.listaccounts(), expected_account_balances)
  File "/c0ban/test/functional/test_framework/util.py", line 38, in assert_equal
    raise AssertionError("not(%s)" % " == ".join(str(arg) for arg in (thing1, thing2) + args))
AssertionError: not({'': Decimal('2288000.00000000'), 'd': Decimal('0E-8'), 'c': Decimal('0E-8'), 'e': Decimal('0E-8'), 'a': Decimal('0E-8'), 'b': Decimal('0E-8')} == {'': 5200, 'd': 0, 'c': 0, 'e': 0, 'a': 0, 'b': 0})
2018-03-22 06:42:29.834000 TestFramework (INFO): Stopping nodes
2018-03-22 06:42:32.043000 TestFramework (WARNING): Not cleaning up dir /tmp/testpktnv1ov
2018-03-22 06:42:32.043000 TestFramework (ERROR): Test failed. Test logging available at /tmp/testpktnv1ov/test_framework.log

c0ban

(Pdb) p node.listaccounts()
{'': Decimal('2288000.00000000'), 'e': Decimal('0E-8'), 'a': Decimal('0E-8'), 'c': Decimal('0E-8'), 'd': Decimal('0E-8'), 'b': Decimal('0E-8')}
(Pdb) p expected_account_balances
{'': 5200, 'e': 0, 'a': 0, 'c': 0, 'd': 0, 'b': 0}

bitcoin

(Pdb) p node.listaccounts()
{'': Decimal('5200.00000000'), 'a': Decimal('0E-8'), 'b': Decimal('0E-8'), 'c': Decimal('0E-8'), 'e': Decimal('0E-8'), 'd': Decimal('0E-8')}

changed following source

2018-03-22 15 49 59

shohu commented 6 years ago

👍

# test/functional/wallet-accounts.py
2018-03-22 06:48:42.225000 TestFramework (INFO): Initializing test directory /tmp/testubnih_gq
2018-03-22 06:48:44.103000 TestFramework (INFO): Stopping nodes
2018-03-22 06:48:46.317000 TestFramework (INFO): Cleaning up
2018-03-22 06:48:46.320000 TestFramework (INFO): Tests successful