diff --git a/bip-0119/simulation.py b/bip-0119/simulation.py index e40d61e..d8d807b 100755 --- a/bip-0119/simulation.py +++ b/bip-0119/simulation.py @@ -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() diff --git a/bip-0330/minisketch.py b/bip-0330/minisketch.py index 5e39779..8817451 100755 --- a/bip-0330/minisketch.py +++ b/bip-0330/minisketch.py @@ -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)))) - diff --git a/bip-0352/bitcoin_utils.py b/bip-0352/bitcoin_utils.py index ee55f2d..9e279e4 100644 --- a/bip-0352/bitcoin_utils.py +++ b/bip-0352/bitcoin_utils.py @@ -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