From 23564058557a345d76573dc8d0d0468015b46f36 Mon Sep 17 00:00:00 2001 From: Riccardo Balbo Date: Sat, 8 Jun 2024 17:13:13 +0200 Subject: [PATCH] Support payment requests and wait for payment --- proto/Payment.proto | 1 + proto/rpc.proto | 18 +++++++++++++++--- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/proto/Payment.proto b/proto/Payment.proto index 87b49a0..606d100 100644 --- a/proto/Payment.proto +++ b/proto/Payment.proto @@ -12,4 +12,5 @@ message Payment { optional PaymentStatus status = 5; optional string data = 6; optional string proof = 7; + optional bool waitForPayment = 8; } diff --git a/proto/rpc.proto b/proto/rpc.proto index 1be6ed8..aafe8ab 100644 --- a/proto/rpc.proto +++ b/proto/rpc.proto @@ -18,7 +18,7 @@ message RpcRequestJob { optional string outputFormat = 8; optional string requestProvider = 9; optional bool encrypted = 10; - optional string userId = 11; + optional string userId = 11; // deprecated: pass as header instead optional uint32 minWorkers = 12; optional Payment bid = 13; } @@ -75,13 +75,22 @@ message RpcJobComplete{ } message RpcRequestPayment{ + string jobId = 3; optional Payment payment = 1; - optional bool waitForPayments = 2 ; } message RpcRequestPaymentResponse{ - PaymentStatus status=1; + bool status=1; +} + +message RpcWaitForPaymentsRequest{ + string jobId = 1; + optional uint32 wait = 2; // max time to wait in ms , 0 or unset means no wait +} + +message RpcWaitForPaymentsResponse{ + bool status=1; } message RpcJobLog { @@ -313,6 +322,8 @@ message RpcPayJobRequest { string protocol = 4; } + + service PoolConnector { // job management rpc requestJob (RpcRequestJob) returns (Job); @@ -327,6 +338,7 @@ service PoolConnector { rpc logForJob(RpcJobLog) returns (Job); rpc payJob(RpcPayJobRequest) returns (Job); rpc requestPayment(RpcRequestPayment) returns (RpcRequestPaymentResponse); + rpc waitForPayments(RpcWaitForPaymentsRequest) returns (RpcWaitForPaymentsResponse); // discovery