mirror of
https://gitlab.com/pulsechaincom/erigon-pulse.git
synced 2025-01-03 17:44:29 +00:00
addresses type
This commit is contained in:
parent
b178ce65e6
commit
7616ab3cde
@ -295,7 +295,7 @@ func (p *TxPool) OnNewBlock(unwindTxs, minedTxs TxSlots, protocolBaseFee, blockB
|
||||
}
|
||||
func setTxSenderID(senderIDs map[string]uint64, senderInfo map[uint64]*senderInfo, txs TxSlots) {
|
||||
for i := range txs.txs {
|
||||
id, ok := senderIDs[string(txs.senders[i*20:(i+1)*20])]
|
||||
id, ok := senderIDs[string(txs.senders.At(i))]
|
||||
if !ok {
|
||||
for i := range senderInfo { //TODO: create field for it?
|
||||
if id < i {
|
||||
@ -303,7 +303,7 @@ func setTxSenderID(senderIDs map[string]uint64, senderInfo map[uint64]*senderInf
|
||||
}
|
||||
}
|
||||
id++
|
||||
senderIDs[string(txs.senders[i*20:(i+1)*20])] = id
|
||||
senderIDs[string(txs.senders.At(i))] = id
|
||||
}
|
||||
txs.txs[i].senderID = id
|
||||
}
|
||||
|
@ -37,6 +37,11 @@ type Hashes []byte // flatten list of 32-byte hashes
|
||||
func (h Hashes) At(i int) []byte { return h[i*32 : (i+1)*32] }
|
||||
func (h Hashes) Len() int { return len(h) / 32 }
|
||||
|
||||
type Addresses []byte // flatten list of 20-byte addresses
|
||||
|
||||
func (h Addresses) At(i int) []byte { return h[i*20 : (i+1)*20] }
|
||||
func (h Addresses) Len() int { return len(h) / 20 }
|
||||
|
||||
// TxContext is object that is required to parse transactions and turn transaction payload into TxSlot objects
|
||||
// usage of TxContext helps avoid extra memory allocations
|
||||
type TxParseContext struct {
|
||||
@ -87,7 +92,7 @@ type TxSlot struct {
|
||||
|
||||
type TxSlots struct {
|
||||
txs []*TxSlot
|
||||
senders []byte // plain 20-byte addresses
|
||||
senders Addresses
|
||||
isLocal []bool
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user