#include #include #include #include #include namespace llarp { namespace dht { PublishServiceJob::PublishServiceJob( const TXOwner &asker, const service::EncryptedIntroSet &introset_, AbstractContext *ctx, bool relayed_, uint64_t relayOrder_) : TX< TXOwner, service::EncryptedIntroSet >(asker, asker, ctx) , relayed(relayed_) , relayOrder(relayOrder_) , introset(introset_) { } bool PublishServiceJob::Validate(const service::EncryptedIntroSet &value) const { if(value.derivedSigningKey != introset.derivedSigningKey) { llarp::LogWarn( "publish introset acknowledgement acked a different service"); return false; } const llarp_time_t now = llarp::time_now_ms(); return value.Verify(now); } void PublishServiceJob::Start(const TXOwner &peer) { parent->DHTSendTo( peer.node.as_array(), new PublishIntroMessage(introset, peer.txid, relayed, relayOrder)); } void PublishServiceJob::SendReply() { parent->DHTSendTo(whoasked.node.as_array(), new GotIntroMessage({introset}, whoasked.txid)); } } // namespace dht } // namespace llarp