BuildOnViction/tomochain-v1

SDK node: failed to update status from New -> Open

thanhnguyennguyen opened this issue · 2 comments

It causes the problem that some orders are hanging in orderbook forever.

DEBUG[09-12|09:22:04] Applying TxMatches of block              number=2130 hash=3ed317022a47                                                      hash_novalidator=49384343fd25
DEBUG[09-12|09:22:04] Mark order as processed                  orderHash=9a77ebff623fa714995379aa1bec2982c2f3c968aaedb445b31d1227cfd3e3a7
DEBUG[09-12|09:22:04] Put processed order                      order="&{Quantity:+36299722452322130 Price:+27548430000000000000000 ExchangeAddress:[13 58 177 75 186 211 217 159 66 3 189 122 17 172 185 72 130 5 14 126] UserAddress:[21 224 141 225 111 83 76 137 8 40 242 160 217 53 67 58 245 179 206 12] BaseToken:[77 126 162 206 148 146 22 214 177 32 243 170 16 22 65 115 97 90 43 108] QuoteToken:[0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1] Status:OPEN Side:BUY Type:LO Hash:[154 119 235 255 98 63 167 20 153 83 121 170 27 236 41 130 194 243 201 104 170 237 180 69 179 29 18 39 207 211 227 167] Signature:0xc007b02230 FilledAmount:+0 Nonce:+91 MakeFee:+1 TakeFee:+1 PairName:BTC/TOMO CreatedAt:1568280121 UpdatedAt:1568280121 OrderID:0 NextOrder:[] PrevOrder:[] OrderList:[] Key:}"
ERROR[09-12|09:22:04] E11000 duplicate key error collection: tomodex.orders index: hash_1 dup key: { : "0x9a77ebff623fa714995379aa1bec2982c2f3c968aaedb445b31d1227cfd3e3a7" }
ERROR[09-12|09:22:04] E11000 duplicate key error collection: tomodex.orders index: hash_1 dup key: { : "0x9a77ebff623fa714995379aa1bec2982c2f3c968aaedb445b31d1227cfd3e3a7" }
DEBUG[09-12|09:22:04] Propagated block import failed           peer=a9c50e0b98eb7213                                 number=2130 hash=3ed317022a47                                                      err="SDKNode: failed to put processed order. Error: E11000 duplicate key error collection: tomodex.orders index: hash_1 dup key: { : \"0x9a77ebff623fa714995379aa1bec2982c2f3c968aaedb445b31d1227cfd3e3a7\" }"
DEBUG[09-12|09:22:04] Queued propagated block                  peer=a9c50e0b98eb7213                                 number=2131 hash=4a76cfead74d                                                      queued=1
DEBUG[09-12|09:22:04] Importing propagated block               peer=a9c50e0b98eb7213                                 number=2131 hash=4a76cfead74d

The scenario is:

  • SDK node got orders via block
  • Try to verify them, remove orders from pending
  • SDK node got orders via whisper, inserted to pending again (an unexpected insertion)
  • Try to put order from step2 to db with status = OPEN (means that order was already processed) but failed due to duplicated index key hash

close as merging #696