Skip to content

Reflect THORNode !2777's pooling of withdraw transaction coin

Multipartite requested to merge Multi/pool-withdraw-coin into develop

[Update: THORNode v1.107.0 implementation block 9989661 (2023-03-16) now filled in.]

If I understand/remember correctly, thornode!1834 (merged) ( in response to thornode#1052 (closed) ) changed withdraw behaviour from {adding the withdraw transaction Asset to the pool and withdrawing it} to {only adding it to the vault balance and not withdrawing it};
this was perhaps relevant for when the Asset withdrawn was a different Asset (for instance non-gas) from the withdraw transaction's Asset.

Specifically, this is reflected by thornode!1834 (merged) including

	if !inboundAsset.IsEmpty() {
		assetAmount = assetAmount.Add(inboundAsset.Amount)
	}

in handler_withdraw.go 's handleV55 (here) and not in its handleV63/handleCurrent.

thornode!2777 (merged) , now merged and not yet implemented in a new version, affects this behaviour again by adding the withdrawal Asset to its pool and keeping it there (so vault and pool balances remain consistent). \

(In contrast with THORNode-recorded vault balances, note that vaults' actual address balances can be a bit higher due to rounded-down amounts lower than 10^-8 .)

This Merge Request makes use of the existing OnWithdraw code which specifies a block height beyond which the new code behaviour applies,
thus should be completed and merged only after the new version's first block height is known.

Alternatively, thornode!2786 (merged) aims to emit a "version" event when the network version changes (in contrast with node-specific "set_version" events),
in which case if Midgard were modified to keep track of THORNode's version a Merge Request indicating a behaviour change from version 1.107.0 could be merged beforehand.

(On that note, for "version" events, at minimum case "version": in mux.go would be appropriate to avoid UnknownsTotal.Add(1) here.)

Edited by Multipartite

Merge request reports