mirror of
https://github.com/aljazceru/ark.git
synced 2025-12-17 12:14:21 +01:00
Add support for Out Of Round txs (#359)
* [common] rework address encoding * new address encoding * replace offchain address by vtxo output key in DB * merge migrations files into init one * fix txbuilder fixtures * fix transaction events * OOR scheme * fix conflicts * [sdk] OOR * update WASM wrappers * revert renaming * revert API changes * update parser.go * fix vtxosToTxsCovenantless * add settled and spent in Utxo and Transaction * Fixes (#5) * Revert unneeded changes and rename claim to settle * Revert changes to wasm and rename claim to settle --------- Co-authored-by: Pietralberto Mazza <18440657+altafan@users.noreply.github.com>
This commit is contained in:
@@ -166,6 +166,24 @@ func (m *paymentsMap) update(payment domain.Payment) error {
|
||||
return fmt.Errorf("payment %s not found", payment.Id)
|
||||
}
|
||||
|
||||
sumOfInputs := uint64(0)
|
||||
for _, input := range payment.Inputs {
|
||||
sumOfInputs += input.Amount
|
||||
}
|
||||
|
||||
for _, boardingInput := range p.boardingInputs {
|
||||
sumOfInputs += boardingInput.Amount
|
||||
}
|
||||
|
||||
sumOfOutputs := uint64(0)
|
||||
for _, receiver := range payment.Receivers {
|
||||
sumOfOutputs += receiver.Amount
|
||||
}
|
||||
|
||||
if sumOfInputs != sumOfOutputs {
|
||||
return fmt.Errorf("sum of inputs %d does not match sum of outputs %d", sumOfInputs, sumOfOutputs)
|
||||
}
|
||||
|
||||
p.Payment = payment
|
||||
|
||||
return nil
|
||||
|
||||
Reference in New Issue
Block a user