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)
| 232 | |
| 233 | |
| 234 | def 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 | |
| 245 | def get_fee(tx_size, feerate_btc_kvb): |