Minor changes to address PR feedback and comments

This commit is contained in:
Jose Coll
2016-11-01 11:39:11 +00:00
parent 96007cd777
commit c5500caf98
3 changed files with 5 additions and 9 deletions

View File

@ -77,10 +77,6 @@ class NodeVaultService(private val services: ServiceHub) : SingletonSerializeAsT
}
}
fun allTransactionNotes(): Map<SecureHash,Set<String>> {
return transactionNotes
}
val _updatesPublisher = PublishSubject.create<Vault.Update>()
fun allUnconsumedStates(): Iterable<StateAndRef<ContractState>> {
@ -104,14 +100,14 @@ class NodeVaultService(private val services: ServiceHub) : SingletonSerializeAsT
}
})
override val currentVault: Vault get() = mutex.locked { Vault(allUnconsumedStates(), allTransactionNotes()) }
override val currentVault: Vault get() = mutex.locked { Vault(allUnconsumedStates(), transactionNotes) }
override val updates: Observable<Vault.Update>
get() = mutex.locked { _updatesPublisher }
override fun track(): Pair<Vault, Observable<Vault.Update>> {
return mutex.locked {
Pair(Vault(allUnconsumedStates(), allTransactionNotes()), _updatesPublisher.bufferUntilSubscribed())
Pair(Vault(allUnconsumedStates(), transactionNotes), _updatesPublisher.bufferUntilSubscribed())
}
}
@ -135,7 +131,6 @@ class NodeVaultService(private val services: ServiceHub) : SingletonSerializeAsT
return currentVault
}
override fun addNoteToTransaction(txnId: SecureHash, noteText: String) {
mutex.locked {
val notes = transactionNotes.getOrPut(key = txnId, defaultValue = {
@ -300,5 +295,4 @@ class NodeVaultService(private val services: ServiceHub) : SingletonSerializeAsT
false
}
}
}

View File

@ -85,7 +85,6 @@ class NodeVaultServiceTest {
@Test
fun addNoteToTransaction() {
databaseTransaction(database) {
val services = object : MockServices() {
override val vaultService: VaultService = NodeVaultService(this)