Use Wallet's transactionDAO instead of creating a copy (#3377)

* Use Wallet's transactionDAO instead of creating a copy

* remove import
This commit is contained in:
benthecarman 2021-07-07 19:01:40 -05:00 committed by GitHub
parent 253f7444c6
commit a82f5aa832
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -29,7 +29,6 @@ import org.bitcoins.dlc.wallet.models._
import org.bitcoins.dlc.wallet.util.DLCStatusBuilder import org.bitcoins.dlc.wallet.util.DLCStatusBuilder
import org.bitcoins.keymanager.bip39.BIP39KeyManager import org.bitcoins.keymanager.bip39.BIP39KeyManager
import org.bitcoins.wallet.config.WalletAppConfig import org.bitcoins.wallet.config.WalletAppConfig
import org.bitcoins.wallet.models.TransactionDAO
import org.bitcoins.wallet.{Wallet, WalletLogger} import org.bitcoins.wallet.{Wallet, WalletLogger}
import scodec.bits.ByteVector import scodec.bits.ByteVector
@ -61,7 +60,6 @@ abstract class DLCWallet
private[bitcoins] val dlcSigsDAO: DLCCETSignaturesDAO = DLCCETSignaturesDAO() private[bitcoins] val dlcSigsDAO: DLCCETSignaturesDAO = DLCCETSignaturesDAO()
private[bitcoins] val dlcRefundSigDAO: DLCRefundSigsDAO = DLCRefundSigsDAO() private[bitcoins] val dlcRefundSigDAO: DLCRefundSigsDAO = DLCRefundSigsDAO()
private[bitcoins] val remoteTxDAO: DLCRemoteTxDAO = DLCRemoteTxDAO() private[bitcoins] val remoteTxDAO: DLCRemoteTxDAO = DLCRemoteTxDAO()
private[bitcoins] val txDAO: TransactionDAO = TransactionDAO()
private def calcContractId(offer: DLCOffer, accept: DLCAccept): ByteVector = { private def calcContractId(offer: DLCOffer, accept: DLCAccept): ByteVector = {
val builder = DLCTxBuilder(offer, accept.withoutSigs) val builder = DLCTxBuilder(offer, accept.withoutSigs)
@ -1283,7 +1281,8 @@ abstract class DLCWallet
} }
private def getClosingTxOpt(dlcDb: DLCDb): Future[Option[TransactionDb]] = { private def getClosingTxOpt(dlcDb: DLCDb): Future[Option[TransactionDb]] = {
val result = dlcDb.closingTxIdOpt.map(txid => txDAO.findByTxId(txid)) val result =
dlcDb.closingTxIdOpt.map(txid => transactionDAO.findByTxId(txid))
result match { result match {
case None => Future.successful(None) case None => Future.successful(None)
case Some(r) => r case Some(r) => r