Skip to content
This repository was archived by the owner on Mar 28, 2023. It is now read-only.

Commit ce555f2

Browse files
authored
Merge pull request #2031 from rodkeys/master
Changed ReleaseFunds func to check if transaction goes through before saving
2 parents 0b1cd2e + ff8c8f8 commit ce555f2

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

core/disputes.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1210,6 +1210,12 @@ func (n *OpenBazaarNode) ReleaseFunds(contract *pb.RicardianContract, records []
12101210

12111211
peerID := order.BuyerID.PeerID
12121212

1213+
// Build, sign, and broadcast transaction
1214+
txnID, err := wal.Multisign(inputs, outputs, mySigs, moderatorSigs, redeemScriptBytes, *big.NewInt(0), true)
1215+
if err != nil {
1216+
return err
1217+
}
1218+
12131219
// Update database
12141220
if n.IpfsNode.Identity.Pretty() == order.BuyerID.PeerID {
12151221
err = n.Datastore.Purchases().Put(orderID, *contract, pb.OrderState_DECIDED, true)
@@ -1221,12 +1227,6 @@ func (n *OpenBazaarNode) ReleaseFunds(contract *pb.RicardianContract, records []
12211227
log.Errorf("ReleaseFunds error updating database: %s", err.Error())
12221228
}
12231229

1224-
// Build, sign, and broadcast transaction
1225-
txnID, err := wal.Multisign(inputs, outputs, mySigs, moderatorSigs, redeemScriptBytes, *big.NewInt(0), true)
1226-
if err != nil {
1227-
return err
1228-
}
1229-
12301230
err = n.SendOrderPayment(&SpendResponse{
12311231
Txid: util.NormalizeAddress(hexutil.Encode(txnID)),
12321232
Currency: &currencyDef,

0 commit comments

Comments
 (0)