btcsuite / btcd

An alternative full node bitcoin implementation written in Go (golang)
https://github.com/btcsuite/btcd/blob/master/README.md
ISC License
6.2k stars 2.36k forks source link

txscript: allow script builder capacity to be specified #1954

Closed guggero closed 1 year ago

guggero commented 1 year ago

The default script builder allocates 500 bytes of memory for each script. That is quite large for most applications and therefore wastes a lot of memory when only small scripts are created. To avoid breaking backward compatibility, we add a new functional option to the NewScriptBuilder function that allows the user to specify the initial allocation size.

cc @Roasbeef, @Crypt-iQ.

coveralls commented 1 year ago

Pull Request Test Coverage Report for Build 4281966818


Files with Coverage Reduction New Missed Lines %
connmgr/connmanager.go 2 86.62%
wire/msgaddrv2.go 16 51.72%
wire/netaddressv2.go 20 74.45%
<!-- Total: 38 -->
Totals Coverage Status
Change from base Build 4163994991: -0.05%
Covered Lines: 26619
Relevant Lines: 48204

💛 - Coveralls