Skip to content

Commit 2de5168

Browse files
author
boaz
committed
feat: update logic for merding hinters
1 parent 9f926f4 commit 2de5168

File tree

1 file changed

+4
-19
lines changed

1 file changed

+4
-19
lines changed

cmds/hinters.go

Lines changed: 4 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import (
55
"github.com/ProtoconNet/mitum-token/operation/token"
66
"github.com/ProtoconNet/mitum-token/state"
77
"github.com/ProtoconNet/mitum-token/types"
8-
"github.com/ProtoconNet/mitum2/launch"
98
"github.com/ProtoconNet/mitum2/util/encoder"
109
"github.com/pkg/errors"
1110
)
@@ -41,25 +40,11 @@ var AddedSupportedHinters = []encoder.DecodeDetail{
4140
}
4241

4342
func init() {
44-
defaultLen := len(launch.Hinters)
45-
currencyExtendedLen := defaultLen + len(currencycmds.AddedHinters)
46-
allExtendedLen := currencyExtendedLen + len(AddedHinters)
43+
Hinters = append(Hinters, currencycmds.Hinters...)
44+
Hinters = append(Hinters, AddedHinters...)
4745

48-
Hinters = make([]encoder.DecodeDetail, allExtendedLen)
49-
copy(Hinters, launch.Hinters)
50-
copy(Hinters[defaultLen:currencyExtendedLen], currencycmds.AddedHinters)
51-
copy(Hinters[currencyExtendedLen:], AddedHinters)
52-
53-
defaultSupportedLen := len(launch.SupportedProposalOperationFactHinters)
54-
currencySupportedExtendedLen := defaultSupportedLen + len(currencycmds.AddedSupportedHinters)
55-
allSupportedExtendedLen := currencySupportedExtendedLen + len(AddedSupportedHinters)
56-
57-
SupportedProposalOperationFactHinters = make(
58-
[]encoder.DecodeDetail,
59-
allSupportedExtendedLen)
60-
copy(SupportedProposalOperationFactHinters, launch.SupportedProposalOperationFactHinters)
61-
copy(SupportedProposalOperationFactHinters[defaultSupportedLen:currencySupportedExtendedLen], currencycmds.AddedSupportedHinters)
62-
copy(SupportedProposalOperationFactHinters[currencySupportedExtendedLen:], AddedSupportedHinters)
46+
SupportedProposalOperationFactHinters = append(SupportedProposalOperationFactHinters, currencycmds.SupportedProposalOperationFactHinters...)
47+
SupportedProposalOperationFactHinters = append(SupportedProposalOperationFactHinters, AddedSupportedHinters...)
6348
}
6449

6550
func LoadHinters(encs *encoder.Encoders) error {

0 commit comments

Comments
 (0)