From 5c9681508b76e22bc977d8db8411e2d776dd04d4 Mon Sep 17 00:00:00 2001 From: Roman Khimov Date: Mon, 24 Feb 2020 18:22:27 +0300 Subject: [PATCH] transaction: strip off a layer of redirection from ClaimTX.Claims We don't need a pointer here and this change makes this field compatible with Transaction.Inputs which is useful in many scenarios. --- pkg/core/blockchain.go | 4 ++-- pkg/core/transaction/claim.go | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/pkg/core/blockchain.go b/pkg/core/blockchain.go index 15f5192a7..3b4f5b276 100644 --- a/pkg/core/blockchain.go +++ b/pkg/core/blockchain.go @@ -1331,8 +1331,8 @@ func (bc *Blockchain) GetScriptHashesForVerifyingClaim(t *transaction.Transactio claim := t.Data.(*transaction.ClaimTX) clGroups := make(map[util.Uint256][]*transaction.Input) - for _, in := range claim.Claims { - clGroups[in.PrevHash] = append(clGroups[in.PrevHash], in) + for i := range claim.Claims { + clGroups[claim.Claims[i].PrevHash] = append(clGroups[claim.Claims[i].PrevHash], &claim.Claims[i]) } for group, inputs := range clGroups { refTx, _, err := bc.dao.GetTransaction(group) diff --git a/pkg/core/transaction/claim.go b/pkg/core/transaction/claim.go index 423a4bc79..05f9b1a16 100644 --- a/pkg/core/transaction/claim.go +++ b/pkg/core/transaction/claim.go @@ -6,7 +6,7 @@ import ( // ClaimTX represents a claim transaction. type ClaimTX struct { - Claims []*Input + Claims []Input } // DecodeBinary implements Serializable interface.