diff options
Diffstat (limited to 'daemon/algod/api/server/v1/handlers/handlers.go')
-rw-r--r-- | daemon/algod/api/server/v1/handlers/handlers.go | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/daemon/algod/api/server/v1/handlers/handlers.go b/daemon/algod/api/server/v1/handlers/handlers.go index f956fb417..0384e887e 100644 --- a/daemon/algod/api/server/v1/handlers/handlers.go +++ b/daemon/algod/api/server/v1/handlers/handlers.go @@ -395,7 +395,7 @@ func computeCreatableIndexInPayset(tx node.TxnWithStatus, txnCounter uint64, pay // computeAssetIndexFromTxn returns the created asset index given a confirmed // transaction whose confirmation block is available in the ledger. Note that // 0 is an invalid asset index (they start at 1). -func computeAssetIndexFromTxn(tx node.TxnWithStatus, l *data.Ledger) (aidx uint64) { +func computeAssetIndexFromTxn(tx node.TxnWithStatus, l *data.Ledger) uint64 { // Must have ledger if l == nil { return 0 @@ -413,6 +413,15 @@ func computeAssetIndexFromTxn(tx node.TxnWithStatus, l *data.Ledger) (aidx uint6 return 0 } + aidx := uint64(tx.ApplyData.ConfigAsset) + if aidx > 0 { + return aidx + } + // If there is no ConfigAsset in the ApplyData, it must be a + // transaction before inner transactions were activated. Therefore + // the computeCreatableIndexInPayset function will work properly + // to deduce the aid. Proceed. + // Look up block where transaction was confirmed blk, err := l.Block(tx.ConfirmedRound) if err != nil { @@ -430,7 +439,7 @@ func computeAssetIndexFromTxn(tx node.TxnWithStatus, l *data.Ledger) (aidx uint6 // computeAppIndexFromTxn returns the created app index given a confirmed // transaction whose confirmation block is available in the ledger. Note that // 0 is an invalid asset index (they start at 1). -func computeAppIndexFromTxn(tx node.TxnWithStatus, l *data.Ledger) (aidx uint64) { +func computeAppIndexFromTxn(tx node.TxnWithStatus, l *data.Ledger) uint64 { // Must have ledger if l == nil { return 0 @@ -448,6 +457,15 @@ func computeAppIndexFromTxn(tx node.TxnWithStatus, l *data.Ledger) (aidx uint64) return 0 } + aidx := uint64(tx.ApplyData.ApplicationID) + if aidx > 0 { + return aidx + } + // If there is no ApplicationID in the ApplyData, it must be a + // transaction before inner transactions were activated. Therefore + // the computeCreatableIndexInPayset function will work properly + // to deduce the aidx. Proceed. + // Look up block where transaction was confirmed blk, err := l.Block(tx.ConfirmedRound) if err != nil { |