-
Notifications
You must be signed in to change notification settings - Fork 89
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Get "paytxfee" and "relayfee" from "getinfo" #51
Comments
Coin amount = Coin.valueOf(dustAmountInSatoshis); // TODO: Make this dynamic I'm not sure, how the encoder and transaction builder could be connected to client setup options, so let's go through it in theory: In Omni Core we use the minimum amount that still gets relayed, based on the own client settings. The relevant value is There is a good chance, that BitcoinJ provides an alternative, and the Bitcoin Core master has a similar helper already, but we currently use GetDustLimit(const CScript& scriptPubKey): //
// Determines minimum output amount to be spent by an output based on
// scriptPubKey size in relation to the minimum relay fee.
//
// This method is very related with IsDust(nMinRelayTxFee) in core.h.
//
int64_t GetDustLimit(const CScript& scriptPubKey)
{
// The total size is based on a typical scriptSig size of 148 byte,
// 8 byte accounted for the size of output value and the serialized
// size of scriptPubKey.
size_t nSize = ::GetSerializeSize(scriptPubKey, SER_DISK, 0) + 156;
// The minimum relay fee dictates a threshold value under which a
// transaction won't be relayed.
int64_t nRelayTxFee = (::minRelayTxFee).GetFee(nSize);
// A transaction is considered as "dust", if less than 1/3 of the
// minimum fee required to relay a transaction is spent by one of
// it's outputs. The minimum relay fee is defined per 1000 byte.
int64_t nDustLimit = nRelayTxFee * 3;
return nDustLimit;
} This is probably a bit cryptic, due to the getting of the relaytxfee and size, but the relevant numbers to use are: |
@msgilligan: for some background about 8cc9800 see: OmniLayer/omnicore#13 (comment). |
I just noticed those values are part of the output of the RPC call "getinfo", so it's possible to get rid of the magic numbers. Won't start this today, but I assume it's basically switching from
value = magicnum
tovalue = getInfoRpcCallResult['key']
.The text was updated successfully, but these errors were encountered: