vulpemventures / go-elements

Go support for Liquid/Elements transactions
MIT License
30 stars 13 forks source link

Does not build with github.com/btcsuite/btcd/btcutil/psbt v1.1.8 #228

Closed Impa10r closed 6 months ago

Impa10r commented 6 months ago

Hi. I need to use go-elements with the recent LND build. It uses psbt v1.1.8. Your last release requires psbt v1.1.4.

I get these errors:

./../../../pkg/mod/github.com/vulpemventures/go-elements@v0.4.0/pset/pset_input.go:112:17: undefined: psbt.ErrInvalidKeydata
../../../../pkg/mod/github.com/vulpemventures/go-elements@v0.4.0/pset/pset_input.go:126:17: undefined: psbt.ErrInvalidKeydata
../../../../pkg/mod/github.com/vulpemventures/go-elements@v0.4.0/pset/pset_input.go:158:17: undefined: psbt.ErrInvalidKeydata
../../../../pkg/mod/github.com/vulpemventures/go-elements@v0.4.0/pset/pset_input.go:164:17: undefined: psbt.ErrInvalidKeydata
../../../../pkg/mod/github.com/vulpemventures/go-elements@v0.4.0/pset/pset_input.go:177:17: undefined: psbt.ErrInvalidKeydata
../../../../pkg/mod/github.com/vulpemventures/go-elements@v0.4.0/pset/pset_input.go:186:17: undefined: psbt.ErrInvalidKeydata
../../../../pkg/mod/github.com/vulpemventures/go-elements@v0.4.0/pset/pset_input.go:220:17: undefined: psbt.ErrInvalidKeydata
../../../../pkg/mod/github.com/vulpemventures/go-elements@v0.4.0/pset/pset_input.go:230:17: undefined: psbt.ErrInvalidKeydata

The reason psbt.ErrInvalidKeydata becomes undefined is because in the new psbt.go it is called ErrInvalidKeyData (capital D).

Will it take long to fix, or should I fork and PM to master?

tiero commented 6 months ago

Thanks for letting us know, but we don't use PSBT package whatsoever, we include btcd for other minor packages.

My understanding you don't need to do either (forking or waiting for us)

Simply in your project go get the right PSBT go package and/or use your own go.mod to "replace" all the instances of btcd to use your own version, not the one that go-elements imports

Impa10r commented 6 months ago

Thanks! Go-elements does reference it in pset module. My project with an updated btcd and peerswap referencing go-elements 0.4.0 did not compile. I ended up forking and building a go-elements version with updated btcd and psbt, while fixing the error above. Then used replace in go.mod to point to it. Works fine for my purposes, but one functional test fails.