mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-19 10:22:23 +00:00
Replace blob announcement time travel with skipping of waitlist.
Signed-off-by: Roberto Bayardo <bayardo@alum.mit.edu>
This commit is contained in:
parent
4253975269
commit
a6ceeddb7c
2 changed files with 27 additions and 17 deletions
|
|
@ -464,6 +464,22 @@ func (f *TxFetcher) loop() {
|
||||||
}
|
}
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
// If this is a blob tx, schedule it to fetch without being
|
||||||
|
// waitlisted since blob txs should not be broadcast. If its
|
||||||
|
// hash is already on the waitlist, it was previously announced
|
||||||
|
// as a non-blob (or unknown) tx type. In this case we'll just
|
||||||
|
// eat the delay and continue handling it as a waitlisted tx to
|
||||||
|
// keep things simple.
|
||||||
|
if ann.metas[i].kind == types.BlobTxType && f.waitlist[hash] == nil {
|
||||||
|
f.announced[hash] = map[string]struct{}{ann.origin: {}}
|
||||||
|
if announces := f.announces[ann.origin]; announces != nil {
|
||||||
|
announces[hash] = ann.metas[i]
|
||||||
|
} else {
|
||||||
|
f.announces[ann.origin] = map[common.Hash]txMetadata{hash: ann.metas[i]}
|
||||||
|
}
|
||||||
|
f.scheduleFetches(timeoutTimer, timeoutTrigger, map[string]struct{}{ann.origin: {}})
|
||||||
|
continue
|
||||||
|
}
|
||||||
// If the transaction is already known to the fetcher, but not
|
// If the transaction is already known to the fetcher, but not
|
||||||
// yet downloading, add the peer as an alternate origin in the
|
// yet downloading, add the peer as an alternate origin in the
|
||||||
// waiting list.
|
// waiting list.
|
||||||
|
|
@ -485,15 +501,7 @@ func (f *TxFetcher) loop() {
|
||||||
}
|
}
|
||||||
// Transaction unknown to the fetcher, insert it into the waiting list
|
// Transaction unknown to the fetcher, insert it into the waiting list
|
||||||
f.waitlist[hash] = map[string]struct{}{ann.origin: {}}
|
f.waitlist[hash] = map[string]struct{}{ann.origin: {}}
|
||||||
if ann.metas[i].kind == types.BlobTxType {
|
f.waittime[hash] = f.clock.Now()
|
||||||
// blob transactions are never broadcast, so to force them
|
|
||||||
// to be fetched immediately we pretend they arrived
|
|
||||||
// earlier.
|
|
||||||
f.waittime[hash] = f.clock.Now() - mclock.AbsTime(txArriveTimeout)
|
|
||||||
idleWait = true // may need to reschedule fetcher due to "time travel"
|
|
||||||
} else {
|
|
||||||
f.waittime[hash] = f.clock.Now()
|
|
||||||
}
|
|
||||||
|
|
||||||
if waitslots := f.waitslots[ann.origin]; waitslots != nil {
|
if waitslots := f.waitslots[ann.origin]; waitslots != nil {
|
||||||
waitslots[hash] = ann.metas[i]
|
waitslots[hash] = ann.metas[i]
|
||||||
|
|
|
||||||
|
|
@ -180,9 +180,8 @@ func TestTransactionFetcherWaiting(t *testing.T) {
|
||||||
}),
|
}),
|
||||||
isScheduled{tracking: nil, fetching: nil},
|
isScheduled{tracking: nil, fetching: nil},
|
||||||
// Announce a non-conflicting blob tx, which should immediately go
|
// Announce a non-conflicting blob tx, which should immediately go
|
||||||
// to fetching after a trivial wait.
|
// to fetching without hitting the waitlist
|
||||||
doTxNotify{peer: "D", hashes: []common.Hash{{0x0b}}, types: []byte{types.BlobTxType}, sizes: []uint32{1000}},
|
doTxNotify{peer: "D", hashes: []common.Hash{{0x0b}}, types: []byte{types.BlobTxType}, sizes: []uint32{1000}},
|
||||||
doWait{time: 0, step: true},
|
|
||||||
isWaiting(map[string][]announce{
|
isWaiting(map[string][]announce{
|
||||||
"A": {
|
"A": {
|
||||||
{common.Hash{0x01}, types.LegacyTxType, 111},
|
{common.Hash{0x01}, types.LegacyTxType, 111},
|
||||||
|
|
@ -239,8 +238,9 @@ func TestTransactionFetcherWaiting(t *testing.T) {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
fetching: map[string][]common.Hash{ // Depends on deterministic test randomizer
|
fetching: map[string][]common.Hash{ // Depends on deterministic test randomizer
|
||||||
"A": {{0x01}, {0x02}, {0x03}, {0x05}},
|
"A": {{0x02}, {0x05}},
|
||||||
"B": {{0x04}},
|
"B": {{0x03}, {0x04}},
|
||||||
|
"C": {{0x01}},
|
||||||
"D": {{0x0B}},
|
"D": {{0x0B}},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
@ -279,8 +279,9 @@ func TestTransactionFetcherWaiting(t *testing.T) {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
fetching: map[string][]common.Hash{
|
fetching: map[string][]common.Hash{
|
||||||
"A": {{0x01}, {0x02}, {0x03}, {0x05}},
|
"A": {{0x02}, {0x05}},
|
||||||
"B": {{0x04}},
|
"B": {{0x03}, {0x04}},
|
||||||
|
"C": {{0x01}},
|
||||||
"D": {{0x0B}},
|
"D": {{0x0B}},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
@ -314,8 +315,9 @@ func TestTransactionFetcherWaiting(t *testing.T) {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
fetching: map[string][]common.Hash{
|
fetching: map[string][]common.Hash{
|
||||||
"A": {{0x01}, {0x02}, {0x03}, {0x05}},
|
"A": {{0x02}, {0x05}},
|
||||||
"B": {{0x04}},
|
"B": {{0x03}, {0x04}},
|
||||||
|
"C": {{0x01}},
|
||||||
"D": {{0x0B}},
|
"D": {{0x0B}},
|
||||||
"E": {{0x06}, {0x07}},
|
"E": {{0x06}, {0x07}},
|
||||||
},
|
},
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue