MCPcopy Create free account
hub / github.com/ElementsProject/elements / ceildiv

Function ceildiv

test/functional/test_framework/util.py:234–242  ·  view source on GitHub ↗

Divide 2 ints and round up to next int rather than round down Implementation requires python integers, which have a // operator that does floor division. Other types like decimal.Decimal whose // operator truncates towards 0 will not work.

(a, b)

Source from the content-addressed store, hash-verified

232
233
234def ceildiv(a, b):
235 """
236 Divide 2 ints and round up to next int rather than round down
237 Implementation requires python integers, which have a // operator that does floor division.
238 Other types like decimal.Decimal whose // operator truncates towards 0 will not work.
239 """
240 assert isinstance(a, int)
241 assert isinstance(b, int)
242 return -(-a // b)
243
244
245def get_fee(tx_size, feerate_btc_kvb):

Callers 1

get_feeFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected