mirror of
https://github.com/bitcoin-s/bitcoin-s.git
synced 2025-02-22 14:33:06 +01:00
Override correct equals functions (#1621)
* Override correct equals functions * Remove no longer needed function
This commit is contained in:
parent
60deb25f35
commit
16dd256716
3 changed files with 15 additions and 9 deletions
|
@ -43,10 +43,13 @@ case class PSBT(
|
|||
import org.bitcoins.core.psbt.InputPSBTRecord._
|
||||
import org.bitcoins.core.psbt.PSBTInputKeyId._
|
||||
|
||||
// Need to define these so when we compare the PSBTs
|
||||
// Need to define this so when we compare the PSBTs
|
||||
// the map lexicographical ordering is enforced
|
||||
def ==(p: PSBT): Boolean = this.bytes == p.bytes
|
||||
def !=(p: PSBT): Boolean = !(this == p)
|
||||
override def equals(other: Any): Boolean =
|
||||
other match {
|
||||
case p: PSBT => this.bytes == p.bytes
|
||||
case _ => other.equals(this)
|
||||
}
|
||||
|
||||
private val inputBytes: ByteVector =
|
||||
inputMaps.foldLeft(ByteVector.empty)(_ ++ _.bytes)
|
||||
|
|
|
@ -10,8 +10,11 @@ sealed abstract class ECDigitalSignature {
|
|||
require(s.signum == 1 || s.signum == 0, s"s must not be negative, got $s")
|
||||
def hex: String = CryptoBytesUtil.encodeHex(bytes)
|
||||
|
||||
def ==(p: ECDigitalSignature): Boolean = this.bytes == p.bytes
|
||||
def !=(p: ECDigitalSignature): Boolean = !(this == p)
|
||||
override def equals(other: Any): Boolean =
|
||||
other match {
|
||||
case sig: ECDigitalSignature => bytes == sig.bytes
|
||||
case _ => other.equals(this)
|
||||
}
|
||||
|
||||
def bytes: ByteVector
|
||||
|
||||
|
|
|
@ -38,15 +38,15 @@ case class BIP39KeyManager(
|
|||
password = BIP39Seed.EMPTY_PASSWORD)
|
||||
}
|
||||
|
||||
def ==(km: KeyManager): Boolean =
|
||||
km match {
|
||||
override def equals(other: Any): Boolean =
|
||||
other match {
|
||||
case bip39Km: BIP39KeyManager =>
|
||||
mnemonic == bip39Km.mnemonic &&
|
||||
kmParams == bip39Km.kmParams &&
|
||||
bip39PasswordOpt == bip39Km.bip39PasswordOpt &&
|
||||
creationTime.getEpochSecond == bip39Km.creationTime.getEpochSecond
|
||||
case _: KeyManager =>
|
||||
km == this
|
||||
case _ =>
|
||||
other.equals(this)
|
||||
}
|
||||
|
||||
private val privVersion: ExtKeyPrivVersion =
|
||||
|
|
Loading…
Add table
Reference in a new issue