Question regarding @JsonIngore in context of an Blockchain Example
I'm afraid you'll have to provide a little more than that. Which book is it? @JsonIgnore, as you correctly pointed out, is used to ignore the logical property used in deserialization, but I can't know why the specific code can't be used, or shouldn't be used, by the user but only by the miner, unless I had more context. I don't understand much from just a few lines of code.
Thanks in advance for the reply, I'll try to provide more details.Here you can see the full "Transaction" class. A transaction and its attributes are defined within:And here is my Class "Miner" respecitvely the Miner Thread:The book Im working with is this one: But its a German book. However the programming language is Java... But a download link für the complete Code can by found under "Materialien".The code which is relevant can be found in Chapter 5. If you need more details just write I will try to provide them.I'm sorry I didn't explain that well enough. The BlockId is the hash of the block.It is clear to me that the block hash is of course set by the miner and not by the user. What I just don't understand is why this setter is then annotated with JsonIgnore.The same applies to the @JsonIgnore of the "sizeInBytes" attribute in the Transaction class or its setter. This attribute is also initiated by the miner and not by the user.
I don't think jsonignore blocks a user from being able to set the variable, it's just a mark to show that they shouldn't but some parts might break if it's edited (if it generally works as a constant in the code - is only edited once in the entire program - there's a chance trying to edit it won't actually do anything). Some compilers might also face errors if the code is changed elsewhere after a jsonignore..It's hard to understand in your example what blockid is? Is it the merkle root, blockhash or something else like blockheight.
@JsonIgnore makes a certain field unable to be serialized or deserialized from JSON.As far as I can tell, void setBlockId is indeed ignored, but there's no comment that reasons it. Have you tried addressing the authors? It's unlikely you find a Bitcointalk user who knows this book.
Not so far but i guess i will try it.This is the complete Explanation of the book related to that but i think its nothing new: "If all hash values have now been processed correctly by the web API, you mustnor check whether any getter and setter methods are used when convertingtion in JSON representations should be ignored. You must then annotate these methods with the @JsonIgnore annotation. In the Transaction class, for example, the setter methods of the attributes sizeInBytes and blockId should be ignored, since these are only set by the miner thread and not by the user."
- Top TopicMore
- 1what happens to bitcoin if the electricity and internet goes out.?
- 2Question regarding @JsonIngore in context of an Blockchain Example
- 3Bollinger Bands and RSI overbought and oversold price detection
- 4Ethereum Merge
- 5Pay Utility Bills With Bitcoin In Nigeria
- Top CoinsMore
- PepePepe (PEPE) is a cryptocurrency and operates on the Ethereum platform. Pepe has a current supply of
- ParticlParticl (PART) is a cryptocurrency launched in 2017. Particl has a current supply of 13,588,745.6551
- HoldstationHoldstation (HOLD) is a cryptocurrency launched in 2022and operates on the zkSync Era platform. Hold
#Wallet#Governance#zkSync Era Ecosystem
- ASTRA ProtocolASTRA Protocol (ASTRA) is a cryptocurrency launched in 2022. ASTRA Protocol has a current supply of
- Moss CoinMoss Coin (MOC) is a cryptocurrency launched in 2018and operates on the Ethereum platform. Moss Coin