From 332dc311e9a21f21f141cfb262c7c23f5ea61ecb Mon Sep 17 00:00:00 2001 From: Aaron Buchwald Date: Wed, 23 Sep 2020 00:38:51 -0400 Subject: Change name of EVMInputs inner sort struct --- plugin/evm/tx.go | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/plugin/evm/tx.go b/plugin/evm/tx.go index fd52222..db49980 100644 --- a/plugin/evm/tx.go +++ b/plugin/evm/tx.go @@ -119,30 +119,30 @@ func (tx *Tx) Sign(c codec.Codec, signers [][]*crypto.PrivateKeySECP256K1R) erro return nil } -// innerSortInputs implements sort.Interface for EVMInput -type innerSortInputs struct { +// innerSortInputsAndSigners implements sort.Interface for EVMInput +type innerSortInputsAndSigners struct { inputs []EVMInput signers [][]*crypto.PrivateKeySECP256K1R } -func (ins *innerSortInputs) Less(i, j int) bool { +func (ins *innerSortInputsAndSigners) Less(i, j int) bool { return bytes.Compare(ins.inputs[i].Address.Bytes(), ins.inputs[j].Address.Bytes()) < 0 } -func (ins *innerSortInputs) Len() int { return len(ins.inputs) } +func (ins *innerSortInputsAndSigners) Len() int { return len(ins.inputs) } -func (ins *innerSortInputs) Swap(i, j int) { +func (ins *innerSortInputsAndSigners) Swap(i, j int) { ins.inputs[j], ins.inputs[i] = ins.inputs[i], ins.inputs[j] ins.signers[j], ins.signers[i] = ins.signers[i], ins.signers[j] } // SortEVMInputsAndSigners sorts the list of EVMInputs based solely on the address of the input func SortEVMInputsAndSigners(inputs []EVMInput, signers [][]*crypto.PrivateKeySECP256K1R) { - sort.Sort(&innerSortInputs{inputs: inputs, signers: signers}) + sort.Sort(&innerSortInputsAndSigners{inputs: inputs, signers: signers}) } // IsSortedAndUniqueEVMInputs returns true if the EVM Inputs are sorted and unique // based on the account addresses func IsSortedAndUniqueEVMInputs(inputs []EVMInput) bool { - return utils.IsSortedAndUnique(&innerSortInputs{inputs: inputs}) + return utils.IsSortedAndUnique(&innerSortInputsAndSigners{inputs: inputs}) } -- cgit v1.2.3