Skip to content

Commit

Permalink
[GENESIS] Prevent double UTXOs from UTXOs and DepositTX
Browse files Browse the repository at this point in the history
  • Loading branch information
peak3d authored and c4t-ag committed Jan 1, 2023
1 parent fcbc50e commit cbdb37f
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions services/indexes/avax/writer.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@ import (
"reflect"
"time"

"github.com/ava-labs/avalanchego/vms/platformvm/locked"

"github.com/palantir/stacktrace"

"github.com/ava-labs/avalanchego/ids"
Expand All @@ -29,6 +27,7 @@ import (
"github.com/ava-labs/avalanchego/vms/components/avax"
"github.com/ava-labs/avalanchego/vms/components/verify"
"github.com/ava-labs/avalanchego/vms/nftfx"
"github.com/ava-labs/avalanchego/vms/platformvm/locked"
"github.com/ava-labs/avalanchego/vms/platformvm/stakeable"
"github.com/ava-labs/avalanchego/vms/secp256k1fx"
"github.com/chain4travel/magellan/cfg"
Expand Down Expand Up @@ -550,6 +549,10 @@ func (w *Writer) ProcessStateOut(
return 0, 0, stacktrace.Propagate(err, "add %v to %v", typedOut.Amount(), amount)
}
case *locked.Out:
// Deposited outs are handled by DepositTX
if genesisutxo && typedOut.LockState().IsDeposited() {
return 0, 0, nil
}
if assetID == w.avaxAssetID {
totalout, err = math.Add64(totalout, typedOut.Amount())
if err != nil {
Expand All @@ -574,7 +577,7 @@ func (w *Writer) ProcessStateOut(
stake,
false,
false,
genesisutxo,
false,
)
if err != nil {
return 0, 0, err
Expand Down

0 comments on commit cbdb37f

Please sign in to comment.