Next scheduled rescrape ... never
Version 1
Last scraped
Scraped on 16/08/2025, 16:24:45 UTC
In that case the old method should still work. You can set
Code:
wallet.relayfee = (lambda: 0)
in the Qt console, and then the GUI lets you do whatever you want. Create even zero-fee txs.
Question: what does the "lambda" part do?

It is monkey-patching / overwriting the `Abstract_Wallet.relayfee` instance method of the wallet object.
https://github.com/spesmilo/electrum/blob/392400295e733e1dd3f0cb14189466e8a76890ef/electrum/wallet.py#L1782-L1783

A lambda is an unnamed function. `lambda: 0` is a function that takes no parameters and returns the integer 0.

`Abstract_Wallet.relayfee` is a function that takes a single parameter, `self`, the wallet object itself, and returns an integer, the minrelayfee in sat/kvbyte units.

When you run the command in the Console, `wallet` is evaluated as the currently open wallet, an instance of the `Abstract_Wallet` class. And we are trying to replace the `relayfee` instance method with something that "looks the same" (has the same API) as the original. It gets a bit involved but basically the `self` parameter we can just ignore in this case.

Perhaps it would be easier to understand if instead of
Code:
wallet.relayfee = (lambda: 0)
I said to use
Code:
wallet.relayfee = (lambda self=wallet: 0)

Both work equally well, I just preferred to be brief. Also less error-prone when typing manually.

but with the second code snippet, you can clearly see that we are replacing a function that takes a single argument, a wallet, and returns an integer, with another function having the same characteristics.

So the point is that you cannot simply set `wallet.relayfee = 0`, that won't work, as `wallet.relayfee` is not supposed to be an integer but rather a function that returns an integer.
Original archived Re: LoyceV's 0.1 sat/vbyte Electrum Server Adventure
Scraped on 16/08/2025, 15:55:24 UTC
In that case the old method should still work. You can set
Code:
wallet.relayfee = (lambda: 0)
in the Qt console, and then the GUI lets you do whatever you want. Create even zero-fee txs.
Question: what does the "lambda" part do?

It is monkey-patching / overwriting the `Abstract_Wallet.relayfee` instance method of the wallet object.
https://github.com/spesmilo/electrum/blob/392400295e733e1dd3f0cb14189466e8a76890ef/electrum/wallet.py#L1782-L1783

A lambda is an unnamed function. `lambda: 0` is a function that takes no parameters and returns the integer 0.

`Abstract_Wallet.relayfee` is a function that takes a single parameter, `self`, the wallet object itself, and returns an integer, the minrelayfee in sat/kvbyte units.

When you run the command in the Console, `wallet` is evaluated as the currently open wallet, an instance of the `Abstract_Wallet` class. And we are trying to replace the `relayfee` instance method with something that "looks the same" (has the same API) as the original. It gets a bit involved but basically the `self` parameter we can just ignore in this case.

Perhaps it would be easier to understand if instead of
Code:
wallet.relayfee = (lambda: 0)
I said to use
Code:
wallet.relayfee = (lambda self=wallet: 0)

Both work equally well, I just preferred to be brief. Also less error-prone when typing manually.

but with the second code snippet, you can clearly see that we are replacing a function that takes a single argument, a wallet, and returns an integer, with another function having the same characteristics.

So the point is that you cannot simply set `wallet.relayfee = 0`, that won't work, as `wallet.relayfee` is not supposed to be an integer but rather a function that returns an integer.