mirror of
https://github.com/bitcoin/bips.git
synced 2025-12-01 14:34:04 +00:00
BIPs 119, 330, 352: code typo and style fixups
Co-authored-by: Tomass <155266802+zeroprooff@users.noreply.github.com> Co-authored-by: emmmm <155267286+eeemmmmmm@users.noreply.github.com>
This commit is contained in:
parent
9297c12729
commit
6340cecfbc
@ -11,7 +11,7 @@ MAX_BLOCK_SIZE = 1e6
|
||||
AVG_INTERVAL = 10*60
|
||||
TXNS_PER_SEC = 0.5*MAX_BLOCK_SIZE/AVG_TX/AVG_INTERVAL
|
||||
MAX_MEMPOOL = MAX_BLOCK_SIZE * 100
|
||||
COMPRESSABLE = 0.05
|
||||
COMPRESSIBLE = 0.05
|
||||
|
||||
|
||||
|
||||
@ -59,7 +59,7 @@ def compressed(rate_multiplier = 1):
|
||||
block_time = np.random.exponential(AVG_INTERVAL)
|
||||
total_time[i] = block_time
|
||||
txns = np.random.poisson(rate_multiplier*get_rate(phase)*block_time)
|
||||
postponed = txns * COMPRESSABLE
|
||||
postponed = txns * COMPRESSIBLE
|
||||
weight = (txns-postponed)*AVG_TX + backlog
|
||||
secondary_backlog += postponed*133 + postponed*34 # Total extra work
|
||||
if weight > MAX_BLOCK_SIZE:
|
||||
@ -88,7 +88,7 @@ if __name__ == "__main__":
|
||||
compressed_txs2, unspendable2, blocktimes_c2 = compressed(2)
|
||||
|
||||
fig, host = plt.subplots()
|
||||
host.set_title("Transaction Compression Performance with %d%% Adoption During Spike"%(100*COMPRESSABLE))
|
||||
host.set_title("Transaction Compression Performance with %d%% Adoption During Spike"%(100*COMPRESSIBLE))
|
||||
fig.subplots_adjust(right=0.75)
|
||||
par1 = host.twinx()
|
||||
par2 = host.twinx()
|
||||
|
||||
@ -1,5 +1,7 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
import random
|
||||
|
||||
######## ENCODING and DECODING ########
|
||||
|
||||
FIELD_BITS = 32
|
||||
@ -31,8 +33,6 @@ def sketch(shortids, capacity):
|
||||
|
||||
######## DECODING only ########
|
||||
|
||||
import random
|
||||
|
||||
def inv(x):
|
||||
"""Compute 1/x in GF(2^FIELD_BITS)"""
|
||||
t = x
|
||||
@ -154,4 +154,3 @@ def decode(sketch):
|
||||
else:
|
||||
sums.append(odd_sums[(i+1)//2])
|
||||
return find_roots(list(reversed(berlekamp_massey(sums))))
|
||||
|
||||
|
||||
@ -33,7 +33,7 @@ def deser_txid(txid: str):
|
||||
|
||||
def deser_compact_size(f: BytesIO):
|
||||
view = f.getbuffer()
|
||||
nbytes = view.nbytes;
|
||||
nbytes = view.nbytes
|
||||
view.release()
|
||||
if (nbytes == 0):
|
||||
return 0 # end of stream
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user