BOXFoundation / boxd

Blockchain for BOX Payout
MIT License
40 stars 10 forks source link

outpoint indices of utxos from split address tx change when tx go from txpool to chain #242

Closed Jerick26 closed 4 years ago

Jerick26 commented 5 years ago

Expected Behavior

outpoint indices keep the same value

Current Behavior

the vout indices behind split address vout become bigger

Possible Solution

execute splitTxOutputs when tx is sent tx pool via rpc

Steps to Reproduce

  1. git checkout develop branch c45f49ae5f5490d9fde6c99e01bbfaf684af3e86
  2. modify test_split_addr.go:157 NewTxs time from 1 to 2
  3. execute integration_tests
  4. timeout for sender balance reach expect value

Context (Environment)

Detailed Description

INFO[0015] wait for balance of sender b1YQAzXnWah39sUMj6e2tCfBgEtZdsAap48 equals to 100000, timeout 15s  source="integration_tests/test_split_addr.go:111" tag=integration
INFO[0015] === RUN   splitAddrRepeatTest                 source="integration_tests/test_split_addr.go:130" tag=integration
INFO[0015] before split addrs txs, sender[b1YQAzXnWah39sUMj6e2tCfBgEtZdsAap48] balance: 100000, receivers balance: [0 0 0 0]  source="integration_tests/test_split_addr.go:143" tag=integration
INFO[0015] send split tx hash: [102 21 155 218 240 228 228 72 12 223 210 233 251 218 123 149 220 221 243 170 215 97 164 220 2 69 224 207 55 137 136 218]
body: {
  "Version": 0,
  "Vin": [
    {
      "PrevOutPoint": {
        "Hash": [
          43,
          248,
          19,
          22,
          67,
          155,
          148,
          32,
          43,
          220,
          29,
          223,
          74,
          151,
          137,
          236,
          154,
          107,
          45,
          129,
          189,
          85,
          120,
          20,
          88,
          67,
          214,
          2,
          113,
          120,
          92,
          192
        ],
        "Index": 1
      },
      "ScriptSig": "RzBFAiEAnth04Q9JqCSA0mYGjs9QKYg7s+wmdjaSpktaW6mUtWECIGmRE6zWwy1zzqEQ/umgovFARR0RofwixK7BcuwGYlayIQJ5UR6mfLQ0gQVA30+Yy0poyH50mg1r9QHg1FGiw1D46A==",
      "Sequence": 0
    }
  ],
  "Vout": [
    {
      "value": 49999,
      "script_pub_key": "dqkUOarXIU9u3JVbIE8UepUpr0JhLCaIrA=="
    },
    {
      "value": 50000,
      "script_pub_key": "dqkUMmBz3SqoIoOBw2gITZtlN1ph5hSIrA=="
    }
  ],
  "Data": null,
  "Magic": 0,
  "LockTime": 0
}  source="integration_tests/test_split_addr.go:170" tag=integration
INFO[0015] send split tx hash: [55 88 193 88 55 75 5 184 45 77 196 161 24 15 71 121 83 230 186 41 239 96 110 161 210 134 234 32 110 4 235 91]
body: {
  "Version": 0,
  "Vin": [
    {
      "PrevOutPoint": {
        "Hash": [
          102,
          21,
          155,
          218,
          240,
          228,
          228,
          72,
          12,
          223,
          210,
          233,
          251,
          218,
          123,
          149,
          220,
          221,
          243,
          170,
          215,
          97,
          164,
          220,
          2,
          69,
          224,
          207,
          55,
          137,
          136,
          218
        ],
        "Index": 1
      },
      "ScriptSig": "RzBFAiEAqE4uB8U1uRsmI1eqm2KcDJxXMHpwqY26V4XmtZ8sct8CIG2hGs5Bcy1z/Fap2gb44pSotOBFBshfdJ2abvFyoHivIQJ5UR6mfLQ0gQVA30+Yy0poyH50mg1r9QHg1FGiw1D46A==",
      "Sequence": 0
    }
  ],
  "Vout": [
    {
      "value": 49998,
      "script_pub_key": "dqkUOarXIU9u3JVbIE8UepUpr0JhLCaIrA=="
    },
    {
      "script_pub_key": "dqkUMmBz3SqoIoOBw2gITZtlN1ph5hSIrA=="
    }
  ],
  "Data": null,
  "Magic": 0,
  "LockTime": 0
}  source="integration_tests/test_split_addr.go:170" tag=integration
INFO[0015] b1YQAzXnWah39sUMj6e2tCfBgEtZdsAap48 sent 2 transactions total 99997 to split address b1Z4iqRgunkWCDmfGA8NaQdb7ED8wZHGhww on peer 127.0.0.1:19111  source="integration_tests/test_split_addr.go:177" tag=integration
INFO[0015] wait for balance of sender b1YQAzXnWah39sUMj6e2tCfBgEtZdsAap48 equal to 0, timeout 15s  source="integration_tests/test_split_addr.go:180" tag=integration
INFO[0027] TPS =   0.00 during last 5s, total txs = 0    source="integration_tests/common.go:127" tag=integration
PANI[0030] Timeout for waiting for b1YQAzXnWah39sUMj6e2tCfBgEtZdsAap48 balance equal to 0, now 50000  source="integration_tests/test_split_addr.go:185" tag=integration
ERRO[0030] &{0xc0000be820 map[tag:integration source:integration_tests/test_split_addr.go:185] 2018-12-29 17:32:22.716891 +0800 CST m=+30.708497972 panic Timeout for waiting for b1YQAzXnWah39sUMj6e2tCfBgEtZdsAap48 balance equal to 0, now 50000 <nil> }  source="integration_tests/test_split_addr.go:43" tag=integration
INFO[0030] done doTest[0]                                source="integration_tests/base_fmw.go:74" tag=integration
INFO[0030] done main.(*SplitAddrTest).HandleFunc-fm      source="integration_tests/base_fmw.go:69" tag=integration
INFO[0030] done split address test                       source="integration_tests/test_split_addr.go:28" tag=integration
INFO[0030] remove 5 keystore files                       source="utils/util.go:215" tag=integration_utils
ERRO[0030] &{0xc0000be820 map[tag:integration source:integration_tests/test_split_addr.go:185] 2018-12-29 17:32:22.716891 +0800 CST m=+30.708497972 panic Timeout for waiting for b1YQAzXnWah39sUMj6e2tCfBgEtZdsAap48 balance equal to 0, now 50000 <nil> }  source="integration_tests/main.go:113" tag=integration
PANI[0030] integration tests exits with 1 errors         source="integration_tests/main.go:117" tag=integration

Possible Implementation