Skip to content

Commit

Permalink
Refresh the ledger pool (#27)
Browse files Browse the repository at this point in the history
Signed-off-by: conanoc <[email protected]>
  • Loading branch information
conanoc authored Mar 11, 2024
1 parent 2d02e92 commit 72c218c
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 9 deletions.
2 changes: 1 addition & 1 deletion ariesframework/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ ktlint {

dependencies {
implementation("org.hyperledger:anoncreds_uniffi:0.2.0-wrapper.1")
implementation("org.hyperledger:indy_vdr_uniffi:0.2.0-wrapper.1")
implementation("org.hyperledger:indy_vdr_uniffi:0.2.1-wrapper.2")
implementation("org.hyperledger:askar_uniffi:0.2.0-wrapper.1")

implementation "org.jetbrains.kotlinx:kotlinx-serialization-json:1.5.0"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -199,5 +199,4 @@ class AgentTest {
// alice will be reset on tearDown
faber.reset()
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,11 @@ class HttpOutboundTransport(val agent: Agent) : OutboundTransport {
val responseText = withContext(Dispatchers.IO) {
val request = okhttp3.Request.Builder()
.url(_package.endpoint)
.post(Json.encodeToString(_package.payload)
.toByteArray() // prevent okHttp from adding charset=utf-8 to the content type
.toRequestBody(DidCommMimeType.V1.value.toMediaType()))
.post(
Json.encodeToString(_package.payload)
.toByteArray() // prevent okHttp from adding charset=utf-8 to the content type
.toRequestBody(DidCommMimeType.V1.value.toMediaType()),
)
.build()
val response = AgentHttpClient.client.newCall(request).execute()
logger.debug("response with status code: {}", response.code)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ import indy_vdr_uniffi.Pool
import indy_vdr_uniffi.Request
import indy_vdr_uniffi.openPool
import indy_vdr_uniffi.setProtocolVersion
import kotlinx.coroutines.GlobalScope
import kotlinx.coroutines.launch
import kotlinx.serialization.encodeToString
import kotlinx.serialization.json.Json
import kotlinx.serialization.json.JsonArray
Expand Down Expand Up @@ -59,8 +61,12 @@ class LedgerService(val agent: Agent) {
} catch (e: Exception) {
throw Exception("Pool opening failed: ${e.message}")
}
val status = pool!!.getStatus()
logger.debug("Pool status: $status")

GlobalScope.launch {
pool?.refresh()
val status = pool?.getStatus()
logger.debug("Pool status after refresh: $status")
}
}

suspend fun registerSchema(did: DidInfo, schemaTemplate: SchemaTemplate): String {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import kotlinx.serialization.json.JsonContentPolymorphicSerializer
import kotlinx.serialization.json.JsonElement
import kotlinx.serialization.json.JsonPrimitive
import org.hyperledger.ariesframework.connection.models.didauth.DidCommService
import org.hyperledger.ariesframework.connection.models.didauth.DidDocService
import org.hyperledger.ariesframework.util.DIDParser

@Serializable(with = OutOfBandDidCommServiceSerializer::class)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ class MediationRecipient(private val agent: Agent, private val dispatcher: Dispa
mediationRecord.assertState(MediationState.Requested)

mediationRecord.endpoint = message.endpoint
mediationRecord.routingKeys = message.routingKeys.map {key ->
mediationRecord.routingKeys = message.routingKeys.map { key ->
if (key.startsWith("did:key:")) {
DIDParser.convertDidKeyToVerkey(key)
} else {
Expand Down

0 comments on commit 72c218c

Please sign in to comment.