wantError: nil,
},
{
+ desc: "package matched tx, one order from db, and the another order from transactions",
+ initOrders: []*common.Order{mock.Btc2EthOrders[0]},
+ transactions: []*types.Tx{mock.Eth2BtcMakerTxs[0], mock.MatchedTxs[10]},
+ wantError: nil,
+ },
+ {
+ desc: "two matched txs use the same orders",
+ initOrders: []*common.Order{mock.Btc2EthOrders[0], mock.Eth2BtcOrders[0]},
+ transactions: []*types.Tx{mock.MatchedTxs[1], mock.MatchedTxs[1]},
+ wantError: errNotMatchedOrder,
+ },
+ {
desc: "existing two matched orders in db, and only one corresponding matched tx in transactions",
initOrders: []*common.Order{
mock.Btc2EthOrders[3], mock.Eth2BtcOrders[2],
wantError: errSpendOutputIDIsIncorrect,
},
{
- desc: "package full matched tx from maker tx",
+ desc: "matched tx and orders from packaged transactions",
initOrders: []*common.Order{},
transactions: []*types.Tx{mock.Btc2EthMakerTxs[0], mock.Eth2BtcMakerTxs[1], mock.MatchedTxs[4]},
wantError: nil,
wantError: nil,
},
{
- desc: "package partial matched tx from db orders",
+ desc: "package partial matched tx from db orders, and the re-pending order continue to match",
initOrders: []*common.Order{mock.Btc2EthOrders[0], mock.Btc2EthOrders[1], mock.Eth2BtcOrders[2]},
transactions: []*types.Tx{mock.MatchedTxs[2], mock.MatchedTxs[3]},
wantError: nil,
},
+ {
+ desc: "cancel the re-pending order",
+ initOrders: []*common.Order{mock.Btc2EthOrders[0], mock.Btc2EthOrders[1], mock.Eth2BtcOrders[2]},
+ transactions: []*types.Tx{mock.MatchedTxs[2], mock.Btc2EthCancelTxs[1], mock.MatchedTxs[3]},
+ wantError: errNotMatchedOrder,
+ },
}
for i, c := range cases {