Giter Club home page Giter Club logo

Comments (6)

davecgh avatar davecgh commented on August 22, 2024

For the most part, the methods that don't return an error either have the error in the returned data set or don't really have any recourse. For example, consider the FetchTxByShaList function. It returns a slice of *TxListReply which includes a field Err for each individual transaction. The intent there is you can request multiple transactions at once and some may fetch successfully while others may not.

On the other hand, take the Close function. Of the 4 implementations we have done, there really is no legitimate response to being unable to close (aside from maybe trying again, but it will almost positively fail too).

I'm not against adding errors to the interface for the others if there is a need since it would be trivial for the existing implementations that don't have an error to return can simply return nil.

from btcdb.

 avatar commented on August 22, 2024

I didn't see error in TxListReply, nice touch.

My initial thoughts were with the ExistsSha and ExistsTxSha methods. If there is an error with the underlying database read then is it OK to just return false without repercussions?

I just dug a bit deper and notice some code comments suggest this issue might be a work in progress with the ldb driver: https://github.com/conformal/btcdb/blob/master/ldb/tx.go#L248 and https://github.com/conformal/btcdb/blob/master/ldb/block.go#L230.

from btcdb.

davecgh avatar davecgh commented on August 22, 2024

I've asked drahn to comment, but I suspect those should have error added.

from btcdb.

davecgh avatar davecgh commented on August 22, 2024

Alright, so I discussed this with drahn and he's in agreement that all of them except FetchTxByShaList and FetchUnSpentTxByShaList make sense to have error returns.

@drahn Close(), ExistsSha(), ExistsTxSha(), RollbackClose(), and Sync() all make sense to have an error return.

I will be taking care of adding these shortly.

from btcdb.

davecgh avatar davecgh commented on August 22, 2024

@qedus Did these changes address your concerns?

from btcdb.

 avatar commented on August 22, 2024

@davecgh yes this completely addresses my concerns. I am also glad Close, Sync and RollbackClose also have error returns even though I agree that in almost every case no one should care about their values. Thanks!

from btcdb.

Related Issues (7)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.