Skip to content

[BUG] Fee Model does not match SV Node #267

@sirdeggen

Description

@sirdeggen

Bug Description

go-sdk and therefore ARC will use this to calculate appropriate fees:

(uint64(math.Ceil(float64(size) / 1000))) * s.Satoshis

BUT in C++ code of the SV Node (which is currently mining blocks for now) it's calculated differently.

Amount CFeeRate::GetFee(size_t nBytes_) const {
    assert(nBytes_ <= uint64_t(std::numeric_limits<int64_t>::max()));
    int64_t nSize = int64_t(nBytes_);

    Amount nFee = nSize * nSatoshisPerK / 1000;

    if (nFee == Amount(0) && nSize != 0) {
        if (nSatoshisPerK > Amount(0)) {
            nFee = Amount(1);
        }
        if (nSatoshisPerK < Amount(0)) {
            nFee = Amount(-1);
        }
    }

    return nFee;
}

The ts-sdk is actually correct:

const fee = Math.ceil((size / 1000) * this.value)

The math.ceiling is never called in SV Node, there is no floor!

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions