Skip to content

Commit 72c218c

Browse files
authored
Refresh the ledger pool (#27)
Signed-off-by: conanoc <conanoc@gmail.com>
1 parent 2d02e92 commit 72c218c

File tree

6 files changed

+15
-9
lines changed

6 files changed

+15
-9
lines changed

ariesframework/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ ktlint {
4747

4848
dependencies {
4949
implementation("org.hyperledger:anoncreds_uniffi:0.2.0-wrapper.1")
50-
implementation("org.hyperledger:indy_vdr_uniffi:0.2.0-wrapper.1")
50+
implementation("org.hyperledger:indy_vdr_uniffi:0.2.1-wrapper.2")
5151
implementation("org.hyperledger:askar_uniffi:0.2.0-wrapper.1")
5252

5353
implementation "org.jetbrains.kotlinx:kotlinx-serialization-json:1.5.0"

ariesframework/src/androidTest/java/org/hyperledger/ariesframework/agent/AgentTest.kt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,5 +199,4 @@ class AgentTest {
199199
// alice will be reset on tearDown
200200
faber.reset()
201201
}
202-
203202
}

ariesframework/src/main/java/org/hyperledger/ariesframework/agent/HttpOutboundTransport.kt

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,11 @@ class HttpOutboundTransport(val agent: Agent) : OutboundTransport {
2727
val responseText = withContext(Dispatchers.IO) {
2828
val request = okhttp3.Request.Builder()
2929
.url(_package.endpoint)
30-
.post(Json.encodeToString(_package.payload)
31-
.toByteArray() // prevent okHttp from adding charset=utf-8 to the content type
32-
.toRequestBody(DidCommMimeType.V1.value.toMediaType()))
30+
.post(
31+
Json.encodeToString(_package.payload)
32+
.toByteArray() // prevent okHttp from adding charset=utf-8 to the content type
33+
.toRequestBody(DidCommMimeType.V1.value.toMediaType()),
34+
)
3335
.build()
3436
val response = AgentHttpClient.client.newCall(request).execute()
3537
logger.debug("response with status code: {}", response.code)

ariesframework/src/main/java/org/hyperledger/ariesframework/ledger/LedgerService.kt

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ import indy_vdr_uniffi.Pool
1010
import indy_vdr_uniffi.Request
1111
import indy_vdr_uniffi.openPool
1212
import indy_vdr_uniffi.setProtocolVersion
13+
import kotlinx.coroutines.GlobalScope
14+
import kotlinx.coroutines.launch
1315
import kotlinx.serialization.encodeToString
1416
import kotlinx.serialization.json.Json
1517
import kotlinx.serialization.json.JsonArray
@@ -59,8 +61,12 @@ class LedgerService(val agent: Agent) {
5961
} catch (e: Exception) {
6062
throw Exception("Pool opening failed: ${e.message}")
6163
}
62-
val status = pool!!.getStatus()
63-
logger.debug("Pool status: $status")
64+
65+
GlobalScope.launch {
66+
pool?.refresh()
67+
val status = pool?.getStatus()
68+
logger.debug("Pool status after refresh: $status")
69+
}
6470
}
6571

6672
suspend fun registerSchema(did: DidInfo, schemaTemplate: SchemaTemplate): String {

ariesframework/src/main/java/org/hyperledger/ariesframework/oob/models/OutOfBandDidCommService.kt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ import kotlinx.serialization.json.JsonContentPolymorphicSerializer
1111
import kotlinx.serialization.json.JsonElement
1212
import kotlinx.serialization.json.JsonPrimitive
1313
import org.hyperledger.ariesframework.connection.models.didauth.DidCommService
14-
import org.hyperledger.ariesframework.connection.models.didauth.DidDocService
1514
import org.hyperledger.ariesframework.util.DIDParser
1615

1716
@Serializable(with = OutOfBandDidCommServiceSerializer::class)

ariesframework/src/main/java/org/hyperledger/ariesframework/routing/MediationRecipient.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ class MediationRecipient(private val agent: Agent, private val dispatcher: Dispa
227227
mediationRecord.assertState(MediationState.Requested)
228228

229229
mediationRecord.endpoint = message.endpoint
230-
mediationRecord.routingKeys = message.routingKeys.map {key ->
230+
mediationRecord.routingKeys = message.routingKeys.map { key ->
231231
if (key.startsWith("did:key:")) {
232232
DIDParser.convertDidKeyToVerkey(key)
233233
} else {

0 commit comments

Comments
 (0)