MCPcopy Create free account
hub / github.com/CovenantSQL/CovenantSQL / sortUnpackedTxs

Method sortUnpackedTxs

blockproducer/branch.go:166–181  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

164}
165
166func (b *branch) sortUnpackedTxs() (txs []pi.Transaction) {
167 txs = make([]pi.Transaction, 0, len(b.unpacked))
168 for _, v := range b.unpacked {
169 txs = append(txs, v)
170 }
171 sort.Slice(txs, func(i, j int) bool {
172 if cmp := bytes.Compare(
173 hash.Hash(txs[i].GetAccountAddress()).AsBytes(),
174 hash.Hash(txs[j].GetAccountAddress()).AsBytes(),
175 ); cmp != 0 {
176 return cmp < 0
177 }
178 return txs[i].GetAccountNonce() < txs[j].GetAccountNonce()
179 })
180 return
181}
182
183func (b *branch) produceBlock(
184 h uint32, ts time.Time, addr proto.AccountAddress, signer *ca.PrivateKey,

Callers 1

produceBlockMethod · 0.80

Calls 4

HashTypeAlias · 0.92
AsBytesMethod · 0.80
GetAccountAddressMethod · 0.65
GetAccountNonceMethod · 0.65

Tested by

no test coverage detected