mirror of
https://github.com/bitcoin-s/bitcoin-s.git
synced 2025-03-03 10:46:42 +01:00
Fix address tag issue where we weren't adding tags to an address, we were replacing existing tags (#1824)
This commit is contained in:
parent
48a7f6f86e
commit
2445003503
2 changed files with 6 additions and 4 deletions
|
@ -128,10 +128,11 @@ abstract class CRUD[T, PrimaryKeyType](implicit
|
|||
* @return t - the record that has been inserted / updated
|
||||
*/
|
||||
def upsert(t: T): Future[T] = {
|
||||
upsertAll(Vector(t)).map { ts =>
|
||||
upsertAll(Vector(t)).flatMap { ts =>
|
||||
ts.headOption match {
|
||||
case Some(updated) => updated
|
||||
case None => throw UpsertFailedException("Upsert failed for: " + t)
|
||||
case Some(updated) => Future.successful(updated)
|
||||
case None =>
|
||||
Future.failed(UpsertFailedException("Upsert failed for: " + t))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -410,7 +410,8 @@ private[wallet] trait AddressHandling extends WalletLogger {
|
|||
address: BitcoinAddress,
|
||||
tag: AddressTag): Future[AddressTagDb] = {
|
||||
val addressTagDb = AddressTagDb(address, tag)
|
||||
addressTagDAO.upsert(addressTagDb)
|
||||
val f = addressTagDAO.create(addressTagDb)
|
||||
f
|
||||
}
|
||||
|
||||
def getAddressTags(address: BitcoinAddress): Future[Vector[AddressTagDb]] = {
|
||||
|
|
Loading…
Add table
Reference in a new issue