OpenBazaar / multiwallet

API based multi-cryptocurrency wallet
MIT License
73 stars 41 forks source link

Change order of Spend operations for multiwallet #36

Closed placer14 closed 5 years ago

placer14 commented 5 years ago

When spending money out of the wallet, we don't want to broadcast to the wallet's user that the transaction was sent over the websocket until AFTER the transaction send is completed and successful. In each of the following wallets, we need the following logic change to be applied during Spend.

Now:

    w.ws.ProcessIncomingTransaction(cTxn)
    _, err = w.client.Broadcast(buf.Bytes())

After:

    _, err = w.client.Broadcast(buf.Bytes())
    if err != nil {
        w.ws.ProcessIncomingTransaction(cTxn)
    }

Applies to: