@@ -13,7 +13,6 @@ import (
1313 "encoding/binary"
1414 "errors"
1515 "fmt"
16- "io"
1716 "math"
1817 "net"
1918 "os"
@@ -31,7 +30,6 @@ import (
3130 safeconversion "github.com/bsv-blockchain/go-safe-conversion"
3231 txmap "github.com/bsv-blockchain/go-tx-map"
3332 "github.com/bsv-blockchain/go-wire"
34- "github.com/bsv-blockchain/teranode/pkg/fileformat"
3533 "github.com/bsv-blockchain/teranode/services/blockassembly"
3634 "github.com/bsv-blockchain/teranode/services/blockchain"
3735 "github.com/bsv-blockchain/teranode/services/blockvalidation"
@@ -1367,12 +1365,13 @@ func (s *server) getTxFromStore(hash *chainhash.Hash) (*bsvutil.Tx, int64, error
13671365// connected peer. An error is returned if the block hash is not known.
13681366func (s * server ) pushBlockMsg (sp * serverPeer , hash * chainhash.Hash , doneChan chan <- struct {},
13691367 waitChan <- chan struct {}, encoding wire.MessageEncoding ) error {
1370- // use a concurrent store to make sure we do not request the legacy block multiple times
1371- // for different peers. This makes sure we serve the block from a local cache store and not from the utxo store.
1372- reader , err := s .concurrentStore .Get (s .ctx , * hash , fileformat .FileTypeMsgBlock , func () (io.ReadCloser , error ) {
1373- url := fmt .Sprintf ("%s/block_legacy/%s?wire=1" , s .assetHTTPAddress , hash .String ())
1374- return util .DoHTTPRequestBodyReader (s .ctx , url )
1375- })
1368+ // Stream directly from Asset Server without disk caching.
1369+ // For large blocks (4GB+), the disk I/O overhead of ConcurrentBlob causes timeouts.
1370+ // The Asset Server handles caching internally, so we stream directly to avoid:
1371+ // 1. Writing the entire block to disk (slow, causes context deadline exceeded)
1372+ // 2. Reading it back from disk (additional I/O overhead)
1373+ url := fmt .Sprintf ("%s/block_legacy/%s?wire=1" , s .assetHTTPAddress , hash .String ())
1374+ reader , err := util .DoHTTPRequestBodyReader (s .ctx , url )
13761375 if err != nil {
13771376 sp .server .logger .Errorf ("Unable to fetch requested block %v: %v" , hash , err )
13781377
0 commit comments