Skip to content

Conversation

@stevenroose
Copy link
Contributor

No description provided.

Copy link
Collaborator

@jonasnick jonasnick left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

would be easy to add a test for this. Otherwise ACK

@RCasatta
Copy link
Collaborator

o.minimum_value() is used to get the Explicit Value, which is always the case for fee, so it works but it was unclear to me by looking at this function.

@stevenroose
Copy link
Contributor Author

@RCasatta I agree, I had to check it as well. This is how it was done in our integration tests, I ported the method here. I guess since we use is_fee, we can assert the value to be explicit afterwards. Let me clean that up and add a test.

@stevenroose stevenroose changed the title Add Transaction::fee getter Fix TxOut::is_fee, add confidential is_explicit and unwrap_explicit, add Transaction::fee Mar 2, 2020
@stevenroose
Copy link
Contributor Author

I noticed that is_fee was actually incomplete according to Elements Core. So I fixed that and added is_explicit and unwrap_explicit methods to the confidential types to help.

@RCasatta
Copy link
Collaborator

RCasatta commented Mar 2, 2020

did you consider having unwrap_explicit() returning a Result? This way you can remove the panic! and also remove is_explicit() and use unwrap_explicit().is_ok() instead

@stevenroose
Copy link
Contributor Author

Yeah but then it's not really an unwrap method like in the stdlib. We could have fn explicit(&self) -> Option<T> instead, like Result::ok; in that case our usage would be value.explicit().unwrap(), which for me is fine as well. In that case, the is_explicit method could just return .explicit().is_some().

@RCasatta
Copy link
Collaborator

RCasatta commented Mar 2, 2020

yeah, Option or like it is now is ok

Make conform with Elements Core:

```c++
    bool IsFee() const {
        return g_con_elementsmode && scriptPubKey == CScript()
            && nValue.IsExplicit() && nAsset.IsExplicit();
    }
```
@stevenroose
Copy link
Contributor Author

I changed it to a Option, can you re-review and ack? I'd like to have this to add feerates to hal-elements.

@RCasatta
Copy link
Collaborator

ack cbb9674

@stevenroose
Copy link
Contributor Author

@apoelstra could you perhaps give me owner permissions on this repo so that I can merge PRs that are ACKed, but not "github-approved"? Currently I can't. I'll try self-approve, but that's weird.

@stevenroose
Copy link
Contributor Author

update: you can't self-approve. Bravo, GitHub :)

Copy link
Collaborator

@jonasnick jonasnick left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK cbb9674

@jonasnick jonasnick merged commit 08dc933 into ElementsProject:master Mar 31, 2020
@shesek
Copy link
Contributor

shesek commented Apr 2, 2020

Is there a reason explicit() was added to Value but not to Asset or Nonce, while unwrap_explicit() was not added to Value but only to the others?

I was refactoring some of my code to take advantage of the new methods, was kind of surprised to see that Asset::explicit() does not exists. I think it would make sense to have all three methods on all three structs.

shesek added a commit to Blockstream/electrs that referenced this pull request Apr 2, 2020
@shesek
Copy link
Contributor

shesek commented Apr 5, 2020

Nice, @stevenroose unified them here: 5d826e8

SatoKentaNayoro pushed a commit to boolnetwork/mempool-electrs that referenced this pull request Nov 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants