MCPcopy Create free account
hub / github.com/ElementsProject/lightning / drain

Method drain

contrib/pyln-testing/pyln/testing/utils.py:1143–1155  ·  view source on GitHub ↗
(self, peer)

Source from the content-addressed store, hash-verified

1141
1142 # This helper sends all money to a peer until even 1 msat can't get through.
1143 def drain(self, peer):
1144 total = 0
1145 msat = 4294967295 # Max payment size in some configs
1146 while msat != 0:
1147 try:
1148 logging.debug("Drain step with size={}".format(msat))
1149 self.pay(peer, msat)
1150 total += msat
1151 except RpcError as e:
1152 logging.debug("Got an exception while draining channel: {}".format(e))
1153 msat //= 2
1154 logging.debug("Draining complete after sending a total of {}msats".format(total))
1155 return total
1156
1157 # Note: this feeds through the smoother in update_feerate, so changing
1158 # it on a running daemon may not give expected result!

Callers 3

test_lockup_drainFunction · 0.80
test_zeroreserveFunction · 0.80
configureMethod · 0.80

Calls 1

payMethod · 0.95

Tested by 2

test_lockup_drainFunction · 0.64
test_zeroreserveFunction · 0.64